Less by Ryan Cramer, bernhard

A module wrapper for Wikimedia’s Less parser that compiles .less files to .css. Also used by the ProcessWire core for AdminThemeUikit customization.

Less parser for ProcessWire

This is a ProcessWire module wrapper for the Wikimedia LESS parser. Originally developed by Bernhard Baumrock with additions by Ryan Cramer. Requires ProcessWire 3.0.164+.

Install


  1. Copy all files included in this module into new directory /site/modules/Less/.
  2. In the ProcessWire admin, go to Modules > Refresh.
  3. Click install for the Less module.

API usage


Compile string and two .less files to a css file

$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');

Access Wikimedia less parser directly

$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

Usage with ProcessWire’s AdminThemeUikit module


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/

License


This module uses the Apache license for consistency with the Wikimedia LESS parser license.

Install and use modules at your own risk. Always have a site and database backup before installing new modules.

Twitter updates

  • ProcessWire 3.0.185 (dev) core updates, plus new Session Allow module— More
    17 September 2021
  • Three new ProcessWire Textformatter modules: Find/Replace, Markdown in Markup, and Emoji— More
    3 September 2021
  • This week we have a new master version released after a year in the making. With nearly 40 pull requests, hundreds of new additions and more than 100 issue reports resolved, this new version has a ton of great new stuff— More
    27 August 2021

Latest news

  • ProcessWire Weekly #384
    In the 384th issue of ProcessWire Weekly we'll cover the latest core updates, introduce a new module called Session Allow, and highlight a new site of the week. Read on!
    Weekly.pw / 18 September 2021
  • ProcessWire 3.0.184 new master/main version
    This week we have a new master/main version released after a full year in the making. As you might imagine, this new version has a ton of great new stuff and we’ll try to cover much of it here.
    Blog / 27 August 2021
  • Subscribe to weekly ProcessWire news

“To Drupal, or to ProcessWire? The million dollar choice. We decided to make an early switch to PW. And in retrospect, ProcessWire was probably the best decision we made. Thanks are due to ProcessWire and the amazing system and set of modules that are in place.” —Unni Krishnan, Founder of PigtailPundits