I am considering replacing a number of static css files with style tags dynamically generated from JavaScript. My purpose is not to build a stylesheet for the whole document, but rather to use it for plugins that get added to the page, like tabs, slideshows, etc. The stylesheets I currently deal with have 10 to 20 lines.
I see several benefits:
- load only a js file instead of both js and css
- ability to define theming on the fly (e.g. enter colors as variables)
- ability to define selectors on the fly (e.g. namespaced class names)
- add browser specific styles
What would be the drawbacks of this approach? Could you recommend any good references on this topic?
I did some research and found the following tools: