Lets say I am building a jQuery plugin that has a number of non-configurable css attributes it needs to apply to DOM elements the plugin itself creates. Is it consider better practice to apply the css directly in the javascript code or is it better to create a css file and just include both the css and javascript files?
I have always been under the impression that is would be better to have the css file just because it seems a bit cleaner and you don't really gain much from having everthing in the javascript code. I mean the size of the css + javascript files would probably be about the same as if you had applied the css through javascript so the only thing you gain is that you only need to request 1 resource file instead of 2 if you apply the css in javascript. I am just curious as I an building a number of jQuery plugins and I have noticed some other plugins that are embedding a lot of css in the javascript instead of a css file.