How to deal with CSS preprocessors like Sass and LESS?
This page describes the latest dev D7 version of the Style (CSS) Settings module. |
Compiling .scss or .less files to .css mangles our inline /* .. */ comments. The suggested way to deal with this is;
Using the 7.x-2.x version that solves the issue. There are some differences in usage. Follow the instructions of the included README.txt file.
Alternatively: For the 7.x-1.x dev version by having a CSS file /css/style_settings.css in the theme's css folder that:
- only contains the CSS that one optionally wants to be configurable from the UI
- is not compiled (no .scss or .less version exists)
- uses the same CSS selectors as that in the .scss or .less files for the CSS it is supposed to override. Read why. Check the compiled CSS files to find them as those in the .scss or .less files are likely hard to find due to the nesting of selectors.
Presuming you declare style_settings as a soft-dependency in the .info file of your theme, the /css/style_settings.css will be ignored (not loaded) if the Style Settings module is not enabled. If it is enabled, the module will take care of loading the style_settings.css file it finds in the active theme (also admin theme). It is loaded as one of the last stylesheets so it overrides CSS rules in the compiled CSS files.
Also the 7.x-2.x version handles an optional /css/style_settings.css in the theme's css folder in the same way. Possible reasons to do so:
- If changing the original theme css, scss or less files with trailing comments is not wanted.
- If CSS exists that only makes sense having if configurable.
- If other default values are desired for configurable CSS.
Help improve this page
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion