I've written my first JQuery plugin and one of it's dependancies is an external css stylesheet. Do you think this is an acceptable strategy to include this in the distributable or should I embed style information in the plugin itself? Should I ship with no style information at all? The visual elements of the plugin make no sense without the stylesheet, and I'd like to allow users to obviously tweak the look and feel too. Just not sure what is the best approach to take.
views:
203answers:
3I would include the external css with the plugin distribution. Embedding the styles with js make it far less appealing imo. Most of the good plugins do this.
Ideally the functional and presentation elements should be separated, in other words the plugin should work without the css file that should be optional.
But we are not living in a perfect world, and considering that probably most of the time a css will be customized, is perfectly acceptable to include the css with the plugin distribution.
You should keep the css to a bare minimum and eventually add additional, more elaborated, css examples.
UI is surely one of the most important plug-ins and it does include css files in its distribution. This is how the distribution looks like:
jquery.js
licence.txt
readme.txt
ui\*.js
themes\*.css
tests\
demos\
I suppose you could use a similar structure. Note that some widgets don't work without the style sheets. The documentation clearly mentions which elements in the css are mandatory.