LESS and Omega
Documentation on integrating the LESS module and Omega theme framework.
Usually when creating a sub-theme adding custom stylesheets is as simple as adding a snippet to your theme's .info file:
stylesheets[all][] = example.css.lessOnly with Omega this goes against the grain and causes the compiled 'example.css.less' to show up before Omega's own CSS files.
So when in Rome, do as Omega does and use the following example:
css[example.css.less][name] = My Project example styles
css[example.css.less][description] = LESS CSS stylesheet for My Project.
css[example.css.less][options][weight] = 10
settings[alpha_css][example.css.less] = 'example.css.less'When you are building a fresh sub-theme that has yet to be enabled, the above example will work perfectly.
If you tried the above and are wondering why its not working, then the most likely reason is that you already enabled your theme and added the .info entries after, but don't worry there is a simple fix.
Read moreLESS CSS Preprocessor
Documentation for the LESS CSS Preprocessor module.
Built using the lessphp library by Leaf Corcoran.
This module will automatically process any LESS files that are added using drupal_add_css or added through your module/theme's .info file.
Add your files just like any other .css file, just with .less as the extension, and they will be automatically processed.
Requirements
- Libraries API.
- lessphp library unpacked so that 'lessc.inc.php' is located at 'sites/all/libraries/lessphp/lessc.inc.php'.
LESS Development:
Syntax
http://leafo.net/lessphp/docs/
File placement
If your source file was "sites/all/modules/test/test.css.less"
Then your compiled file will be "sites/[yoursite_or_default]/files/less/[random.string]/sites/all/modules/test/test.css"
Use:
The following two examples provide equivalent functionality.
drupal_add_css:
<?php
$module_path = drupal_get_path('module', 'less_demo');
drupal_add_css($module_path . '/styles/less_demo.css.less');
?>.info file:
stylesheets[all][] = styles/less_demo.css.less