LESS 7.x-3.0
You are browsing documentation for an older version of Drupal, which is not supported any longer, and the information may not be correct. See current documentation for Contributed modules
Documentation for the LESS CSS Preprocessor module.
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.
- less.php library unpacked so that 'lessc.inc.php' is located at 'sites/all/libraries/lessphp/lessc.inc.php'.
LESS Development:
Syntax
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:
$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
Compatibility:
Should work with most themes and caching mechanisms.
CSS Aggregation
Fully compatible with "Optimize CSS files" setting on "Admin->Site configuration->Performance" (admin/settings/performance).
RTL Support
RTL support will work as long as your file names end with ".css.less".
Assuming your file is named "somename.css.less", Drupal automatically looks for a file name "somename-rtl.css.less"
Contributed Modules
Confirmed to work with:
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