hellogerard / less-slim-middleware
Slim Framework middleware to compile LESS CSS files on-the-fly. Supports minification and caching.
Installs: 948
Dependents: 0
Suggesters: 0
Security: 0
Stars: 21
Watchers: 3
Forks: 4
Open Issues: 1
pkg:composer/hellogerard/less-slim-middleware
Requires
- php: >=5.3.0
- kriswallsmith/assetic: 1.1.*@dev
- natxet/cssmin: dev-master#9801e2a0de7ae252ca4f2b85542d75a82047a8b4
- oyejorge/less.php: ~1.5
This package is auto-updated.
Last update: 2025-10-17 11:09:16 UTC
README
This Slim Framework middleware will compile
LESS CSS files on-the-fly using the
Assetic library. It supports
minification and caching, also via Assetic.
It will intercept requests for CSS files and attempt to find a corresponding
LESS file. If one is found, it will compile the file to CSS and serve it,
optionally saving the CSS to a filesystem cache. Inspired by
less.js-middleware.
Usage
src- Directory to look for LESS files. REQUIRED Example: ifsrcis set to/path/to/public, and a request forhttp://mysite.com/css/style.cssis received, then it will look for a LESS file in/path/to/public/css/style.less.cache- Cache CSS file to filesystem. Default istrue.cache.dir- Directory for the cached CSS file. Default issrc.minify- Minify the CSS output. Default istrue.debug- Send debug messages to Slim Logger. Default isfalse.
Example:
use \Slim\Slim; use \Slim\Middleware\Less; $app = new Slim(); $app->add(new Less(array( 'src' => '/path/to/public', 'cache' => true, 'cache.dir' => '/path/to/cache', 'minify' => true, 'debug' => false )));