Clone this repo into your Yii application's protected/extensions dir
cd /path/to/your/yii_app/protected/extensions mkdir lessCss cd lessCss git clone [email protected]:zsoltlengyelit/LessCSS-for-Yii.git
An exmample of use of LessCss:
// app/themes/some_theme/assets/css/test.less// LESS .rounded-corners (@radius: 5px) { border-radius: @radius; -webkit-border-radius: @radius; -moz-border-radius: @radius; } #header { .rounded-corners; } #footer { .rounded-corners(10px); }
// SiteController.php file public function actionIndex() { Yii::import('ext.lessCss.LessCss');Yii::app()->clientScript ->registerCSSFile( // appends parsed less to HEAD tag LessCss::getCssUrl(Yii::app()->theme->basePath.'/assets/css/test.less') // will try cached parsing ); $this->render('index'); }