Wrapper for less.php to integrate LESS into SilverStripe
A wrapper for less.php to integrate LESS into SilverStripe.
?flush
) to regenerate CSS stylesheets (ie. force undetected less changes with @import)assets/_css
and automatically modifies Requirements
pathsurl('../image.png')
will get rewritten as url('/path/to/image.png')
depending on your website's root folder)Live
mode (may require an initial ?flush
)For SilverStripe 3, please refer to the SilverStripe3 branch.
composer require axllent/silverstripe-less
You need refer to your less files by their full LESS filenames (eg:stylesheet.less
).
<?php
use SilverStripe\CMS\Controllers\ContentController;
use SilverStripe\View\Requirements;
class PageController extends ContentController
{
public function init()
{
parent::init();
Requirements:css('resources/themes/site/css/stylesheet.less');
}
}
The generated HTML will point automatically to the processed CSS file in assets/_css
rather than the original less file location, for example
<link rel="stylesheet" type="text/css" href="/assets/_css/themes-site-css-stylesheet.css?m=123456789" />
Module rating system helping users find modules that are well supported. For more on how the rating system works visit Module standards
Score not correct? Let us know there is a problem