A configurable LESS compiler for Symfony projects.
A console LESS compiler for Symfony projects, configurable through a .dotless
config file.
php composer require mediagone/dotless
Add your LESS configuration to a .dotless
file at the root of your project.
A default configuration could be:
{
"targets": [
{
"header": "/*****************************************/\n/* My compiled styles.\n/*****************************************/",
"output": "public/styles.css",
"includes": ["templates/"],
}
]
}
The above example will compile any .less
files found in the templates/
directory into the public/styles.css
file.
A special type of file (.gless
) can be used to define variables in each LESS file, according to their relative hierarchy:
dir/
other_vars.gless
other_styles.less
vars.gless
styles.less
In the previous example, vars.gless
will be available in both styles.less
and other_styles.less
, but other_vars.gless
will only be available in the later.
Compile your LESS using the following symfony's command :
php bin/console dotless:compile
You can minify the output CSS files using the --minify
option:
php bin/console dotless:compile --minify