This is a ProcessWire module wrapper for the Wikimedia LESS parser. Originally developed by Bernhard Baumrock with additions by Ryan Cramer.
- ProcessWire 3.0.179 or newer (3.0.229+ preferable)
- PHP 7.4 or newer
- Copy all files included in this module into new directory
/site/modules/Less/. - In the ProcessWire admin, go to Modules > Refresh.
- Click install for the Less module.
$less = $modules->get('Less');
$less->setOption('compress', true);
$less->addStr('@color: #4D926F; h2 { color: @color; }');
$less->addFile('/path/to/file1.less');
$less->addFile('/path/to/file2.less', '/url/to/images/');
$less->saveCss('/path/to/file.min.css');
$parser = $less->parser();
$parser->parseFile('/path/to/file.less');
$css = $parser->getCss();
For details about API methods you can access from $parser see:
https://github.com/wikimedia/less.php/blob/v4.1.1/API.md
Install this module to add the ability to customize the ProcessWire core AdminThemeUikit admin theme module CSS. For this usage, you must have ProcessWire 3.0.179 or newer. See instructions here: https://processwire.com/blog/posts/pw-3.0.179/
This module uses the Apache license for consistency with the Wikimedia LESS parser license.