Bachir Soussi Chiadmi 7c96373038 security update core+modules | 9 سال پیش | |
---|---|---|
.. | ||
classes | 9 سال پیش | |
engines | 9 سال پیش | |
includes | 9 سال پیش | |
less_demo | 9 سال پیش | |
scripts | 9 سال پیش | |
styles | 9 سال پیش | |
tests | 9 سال پیش | |
.gitignore | 9 سال پیش | |
LICENSE.txt | 9 سال پیش | |
README.md | 9 سال پیش | |
composer.json | 9 سال پیش | |
less.api.php | 9 سال پیش | |
less.drush.inc | 9 سال پیش | |
less.info | 9 سال پیش | |
less.install | 9 سال پیش | |
less.module | 9 سال پیش |
This module allows for automatic compilation of LESS styles sheets.
LESS requires at least one of three possible engines available:
This is a pure PHP implementation, which is good for shared hosting, or if you don't feel comfortable installing or configuring software on your server.
It lacks the ability to execute javascript embedded in .less files, so some LESS libraries might not work.
Requirements:
Less.php
is located at sites/all/libraries/less.php/Less.php
You can read about how to install here: less.js
Please read Command Line Requirements to ensure that less.js is installed properly.
leafo/lessphp Deprecated
leafo/lessphp library unpacked so that lessc.inc.php
is located at sites/all/libraries/lessphp/lessc.inc.php
.
This library is no longer recommended as it lacks support for a majority of new features in the latest canonical LESS.
Once installed, you must select your engine on 'admin/config/development/less'.
Less engines written in PHP do not support embedded JavaScript evaluation.
Write your CSS rules without vendor prefixes (in fact, forget about them entirely)
Autoprefixer will use the data based on current browser popularity and property support to apply prefixes for you.
Please read Command Line Requirements to ensure that autoprefixer is installed properly.
Both less.js and postcss/autoprefixer require that PHP can call these programs directly from the command line.
It is up to the installer (you) to ensure that the lessc
and/or autoprefixer
are able to be called by PHP without a full path to the binary.
Thus is it required that you configure your PATH for the user that your PHP installation runs under to ensure that these programs can be run by name without the full path.
LESS Development:
Syntax: http://lesscss.org/features/
File placement:
If your source file was sites/all/modules/test/test.css.less
Then your compiled file will be sites/[yoursite]/files/less/[random.string]/sites/all/modules/test/test.css
The following two examples provide equivalent functionality.
<?php
$module_path = drupal_get_path('module', 'less_demo');
drupal_add_css($module_path . '/styles/less_demo.css.less');
?>
stylesheets[all][] = styles/less_demo.css.less
For automatic variable and function association with non globally added stylesheets, you can associate a stylesheet using this notation in .info files:
less[sheets][] = relative/path/to/stylesheet.css.less
Should work with most themes and caching mechanisms.
Fully compatible with "Optimize CSS files" setting on "Admin->Site configuration->Performance" (admin/settings/performance).
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"
Variable defaults can be defined in .info files for modules or themes. Any variables defined will be automatically available inside style sheets associated with the module or theme.
.info file:
less[vars][@varname] = #bada55
Look in less.api.php for LESS Variable hooks.