I think a fairly standard way is to simply require that the corresponding CSS file is also used whenever the plugin is used.
You may have your jQuery plugin though:
$('head').append('<link rel="stylesheet" href="/css/myPlugin.css" />');
Or even:
if (!$('head>link[href$="myPlugin.css"]').size()) // if the stylesheet isn't already included $('head').append('<link rel="stylesheet" href="/css/myPlugin.css" />');
Better yet, put this in your own plugin:
$.extend({addStyleSheet : function (nameOfPlugin) { if (!$('head>link[href$="' + nameOfPlugin + '.css"]').size())
Then in your plugin just name it like this:
$.addStyleSheet('myPlugin');
source share