user stylesheets and colorset stylesheets
Posted: Thu Feb 25, 2016 2:27 am
We had a discussion on Gibhub about user.css hierarchy. That discussion focused mostly on user.css existing in a theme folder vs. 2k11, etc.
I am about to release a new theme that, like Bulletproof, uses color sets (green, blue etc).... so, in addition to style.css, the theme will load optional style sheets for these colors. Using bulletproof as an example:
The purpose of these colorset style sheets, is to override default styles listed in style.css, just as user.css overrides style.css.
User.css is appended to style.css.. unlike color stylesheets which are loaded in addition to style.css... and in past practice, after the core style.css so as to override anything that needs to change for that color.
By automagically including user.css, we no longer have the ability to determine where user.css loads. So, we either have this:
style.css
user.css (auto appended via {$head_link_stylesheet})
mycolor_style.css
or we have this:
mycolor_style.css
style.css
user.css
So, at the moment, the only way for user.css to override a colorset, is to load the colorset BEFORE the theme's core stylesheet. I am not a fan of loading a colorset before style.css - If no colorset is selected, then style.css is the only theme stylesheet loaded. If colorsets exist, then at least one colorset must be loaded to represent the default colors, which are then replaced by different colorset styles. I hope that made sense.
This isn't just about colorset stylesheets - some themes also contain stylesheets for printing, different browsers, etc. For user.css to truly override anything in a theme, it must be called after all other styles...
Thoughts?
Anyway, what I am wondering is this: can we have a hook or something that can be used (perhaps as an option) to determine exactly where a user stylesheet gets loaded?
I am about to release a new theme that, like Bulletproof, uses color sets (green, blue etc).... so, in addition to style.css, the theme will load optional style sheets for these colors. Using bulletproof as an example:
Code: Select all
{if $template_option.colorset}<link rel="stylesheet" type="text/css" href="{$serendipityHTTPPath}templates/{$template}/{$template_option.colorset}_style.css" />{/if}
User.css is appended to style.css.. unlike color stylesheets which are loaded in addition to style.css... and in past practice, after the core style.css so as to override anything that needs to change for that color.
By automagically including user.css, we no longer have the ability to determine where user.css loads. So, we either have this:
style.css
user.css (auto appended via {$head_link_stylesheet})
mycolor_style.css
or we have this:
mycolor_style.css
style.css
user.css
So, at the moment, the only way for user.css to override a colorset, is to load the colorset BEFORE the theme's core stylesheet. I am not a fan of loading a colorset before style.css - If no colorset is selected, then style.css is the only theme stylesheet loaded. If colorsets exist, then at least one colorset must be loaded to represent the default colors, which are then replaced by different colorset styles. I hope that made sense.
This isn't just about colorset stylesheets - some themes also contain stylesheets for printing, different browsers, etc. For user.css to truly override anything in a theme, it must be called after all other styles...
Thoughts?
Anyway, what I am wondering is this: can we have a hook or something that can be used (perhaps as an option) to determine exactly where a user stylesheet gets loaded?