Why injectCSS? Why make it? What is it solving?
- The primary goal was to create an easy way to include multi-line (lots) of CSS using Javascript.
- Can reduce number of files in a JS plugin or project (My goal was one).
- A test run at jsperf.com shows that injecting CSS rules for a vast number of elements is very fast.
Example Usage
With RequireJS
With no dependencies
Compatability
Tested successfully on:
- Chrome (+mobile)
- Firefox
- Safari (+mobile)
- IE 10+
Download
The code is on GitHub. Download, use and modify as you please.
No comments:
Post a Comment