PHPackages                             axllent/silverstripe-less - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. axllent/silverstripe-less

ActiveSilverstripe-vendormodule

axllent/silverstripe-less
=========================

Wrapper for less.php to integrate LESS into Silverstripe

3.0.1(2y ago)62.1k4MITPHP

Since Jan 4Pushed 5mo ago3 watchersCompare

[ Source](https://github.com/axllent/silverstripe-less)[ Packagist](https://packagist.org/packages/axllent/silverstripe-less)[ Docs](https://github.com/axllent/silverstripe-less)[ RSS](/packages/axllent-silverstripe-less/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (3)Versions (23)Used By (0)

Less.php module for Silverstripe
================================

[](#lessphp-module-for-silverstripe)

A wrapper for [less.php](https://github.com/wikimedia/less.php) to integrate [LESS](http://lesscss.org/) into Silverstripe.

Features
--------

[](#features)

- Integrates a fork of less.php seamlessly into Silverstripe
- Includes flushing option (`?flush`) to regenerate CSS stylesheets (ie. force undetected less changes with @import)
- Writes processed \*.css files into `assets/_css` and automatically modifies `Requirements` paths
- Allows custom global variables to be passed through to less compiling (yaml configuration)
- Automatic compression of CSS files when in `live` mode (may require an initial `?flush`)
- Adds any processed editor.less files to TinyMCE (must be included in your front-end template)

Requirements
------------

[](#requirements)

- Silverstripe ^5

Installation
------------

[](#installation)

```
composer require axllent/silverstripe-less
```

Usage
-----

[](#usage)

You need refer to your less files by their full LESS filenames (eg:`stylesheet.less`).

Note: The `less.php` compiler transforms relative paths like `url('../images/logo.png')` into `url('/themes/site/images/logo.png')` based on the path provided as you included the files, meaning these won't work in Silverstripe due to the exposed directory structure via (`_resources/...`). The two simplest solutions are:

1. Use a variable in your less files to provide the path to your files (ie: do not use relative paths), or:
2. Include your files using "\_resources" in the path to your less file, eg: `Requirements:css('_resources/themes/site/css/stylesheet.less');`

Example
-------

[](#example)

In your page controller:

```
