I have been grappling with this issue for quite some time now, and I am seeking feedback from others. I am in the process of creating a personalized library to expedite web app development, and I want to ensure that I adopt the correct approach. My intention is to utilize this particular method:
$.fn.someSlider = function(){
var coreStyle = '.slider ul { white-space: nowrap; } .slider ul li {display: inline-block}', coreStyleTemplate = '<style><\/style>';
}
However, I am hesitant about embedding the base CSS directly into the widget as it often receives disapproval - according to several users on SO who recommend using CSS style rules instead. I am aiming for a seamless experience where everything just works effortlessly, rather than requiring users to incorporate a separate style sheet solely for the purpose of running my plugins... which can be quite bothersome!
To clarify further: I wish to include all fundamental style rules necessary for the widgets to function properly within the script itself. Users should be able to easily tweak the appearance of the widget by adding their own style rules to their style sheet.
For instance:
Instead of having to navigate through numerous base styles searching for something like font color as shown here... .slider {display: inline-block; color: #000; someotherconfusingrule : blahblah; }
The user could simply create a new rule with the same class name/selector being used - and specify the alterations they wish to make to the default script styles
They would just input
.slider {color: #000};
I appreciate any assistance provided by the wonderful community here at SO!