This class provides direct compilation of less to files to css extending from CClientscript and registering css files the normal way that yii does.
Requirements ¶
Yii 1.1.8 PHP >= 5.3
Usage ¶
Copy -Copy files under extension folder
Configuration --config/main.php
// application components
'components' => array(
'clientScript' => array(
'class' => 'ext.JLess.JLessCClientScript', //Extend CClientScript
'jLessOptions' => array(
'vendor' => 'agar', //Less-(leafo or agar)
'destination'=>'/css',
'forceCompile'=>false, //Enables force compiling, Atention file will always be compiled when it had changes
'subfolder'=>true, //Option necessary for loading the files, we need to know if the application is inside one subfolder or not (true (default) or false)
//You can include options directly to the compiler
//This options are related directly with the compiler that you choose
'compiler'=>array(
'compress'=>true,
),
),
),
Usage -Use it like you use to include a css file
Yii::app()->clientScript->registerLessFile(Yii::app()->request->baseUrl . '/less/mystyles.less'); //If you want to save in a generic place defined in config
or
Yii::app()->clientScript->registerLessFile(Yii::app()->theme->baseUrl . '/less/mystyles.less','',Yii::app()->theme->baseUrl.'/css/mystyles.css'); //If you want to save in a specific place like under a folder inside theme
TODO ¶
Include compilation of scss files
Resources ¶
- [[Project page]](https://github.com/n3okill/JLess "Project Page")
Changes ¶
2012-10-11
Added an option to verify if the application is inside one folder
If you have any questions, please ask in the forum instead.
Signup or Login in order to comment.