-
Notifications
You must be signed in to change notification settings - Fork 27
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
🔬 Find out how to import CSS files into JavaScript #216
Comments
if you setup a handler script like: <script> { let worker=new Worker("/path/to/module.js","options"||undefined); worker.onmessage=function(d){document.head.insertAdjacentHTML("beforeend","<style>"+d.data+"</style>")}} and you setup your module to post back the stored css like: var stored_css="body {color:white;background:black}"; then it will work no problem just make sure to validate the data that the handler receives is correct and not fraudulent |
@Shaxowfall, welcome to ChesslabLab. Thank you for joining the community. Please make sure to read the Contributing Guidelines. Also thank you for posting a comment on this issue! If I'm not very much mistaken, this should be done using CSS module scripts. |
We can just install a dark/light mode package and use localStorage to find out what mode is active for each user and in global css file we can define color styles for light and dark modes |
The
dark
and thelight
theme constants currently defined as strings in the assets/js/pages/apply_settings.js file need to be imported from separate files similar to how the translation files in the assets/js/translations folder can be imported throughout the codebase.See #203
Happy coding!
The text was updated successfully, but these errors were encountered: