Loading custom themes, standard/recommend method?
When loading custom themes made by the user & stored somewhere for example local storage, I assume the flow is: 1-Read theme data from storage 2-Flatten theme & generate CSS text 3-Dynamically inject it as a style to the document, os use cssom to add sheets 4-Use [data-theme="custom1...n"] to switch themes Or Have a single placeholder [data-theme="slot"]{} In your static CSS, just read the user selected theme only, flatten, loop over variables & use cssom set property to set the values of tge slot style to those of the theme, & use data-tgeme=slot to activate it, & when the user selects another custom theme load it the same way using cssom & so on & so on, basically injecting a style css vs cssom adoptsheet (which I think has/had? A bug in FF), & load all/many (maybe lazy load), or swap in & out in a static pre-defined css style slot? submitted by /u/Ok-Weakness-3206 [link] [留言]