I've somewhat recently started building my own jQuery plugins to modularize some ideas I find myself using frequently. I've noticed many jQuery plugins have a separate js and css files to include, but I've begun to question that logic.
My question is, should I just be embedding the css in my JavaScript?
The Pros I can think of:
- Reduced http requests
- Plugin specific CSS isn't loaded if js is disabled
- Ease of use - can be as easy as one copy-paste and the deed is done.
Cons?:
- No seperation of concerns
- More difficult to organize code how you want to
- Confusing or difficult to edit core css for the uninitiated
- can cause difficulty when releasing plugin updates
.css({'etc':'etc'})at present, but I'm sure there's a better way