With this extension, you can use Less CSS files with registerCSSFile.
The code is based on zsoltlengyelits, LessCSS-for-Yii extension. I've updated it so,
- it uses the assetsfolder defined by CAssetmanager
- You have a global caching setting, instead of per file
- Updated to the latest lessc parser which includes a compress css feature
- It uses CClientscript to register the outputted css automatically
Yii 1.1 or above
Copy the folder to your extension folder (protected/extensions).
'components' => array( 'clientScript' => array( 'class' => 'ext.LessClientscript.LClientscript', 'caching' => true, //use the cached css file if available 'compress' => false, //remove whitespace and linearize to 1 line ) );
Now you can add it in your view or controller:
- Store temporary less file in runtime folder
- Fixed bug where if you provided a file with no css in it, it could not find the assets file
- Better commenting
- Return clientscript object for chaining