Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatibility with cache #19

Open
TasvireZendegi opened this issue Dec 1, 2019 · 2 comments
Open

Compatibility with cache #19

TasvireZendegi opened this issue Dec 1, 2019 · 2 comments

Comments

@TasvireZendegi
Copy link

Hi there, I just wanna say I love this plugin, and it’s really easy to customize it with CSS!

One problem I’ve been facing though is it doesn’t work with cache plugins.
If the page is cached the page will always flash the previous colors every time I load a new page.

I’ve tried everything out there, searched the web for anything I find.

Any help would be appreciated,

Thanks!

@coliff
Copy link
Owner

coliff commented Dec 12, 2019

Hi there - thanks for the feedback. Yes, I think we need to do something so that the value of the setting is read sooner so that the dark-mode setting is added to the body tag before the main page content is rendered.

Ideally the JavaScript should be higher in the DOM. For now, the only advice I have is to load the <script src="dark-mode-switch.min.js"></script> as high as possible on your page - maybe right after the switch in the top navbar.

@TasvireZendegi
Copy link
Author

this site also use dark mode(custom code) and does not have any problem with cache.(Of course I might be wrong)
This may give you a clue to the problem
https://digiato.com/
sorry,I am little slow in english
best regards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants