Yii Less Extension gives a simple way to include LESS files in your Yii view files. Yii Less Extension adds a method to the
CClientScript class, namely
registerLessFile which is very similary to the
registerCssFile method, to directly link LESS files in your Yii view files.
- Download and extract the extension package to
protected/extensions/yiilessdirectory of your application.
- Make the following modifications to your
protected/config/main.phpunder the components section of the config:
PHP1234567891011array(// .....'components'=>array(// .....'clientScript' => array('class' => 'ext.yiiless.components.YiiLessCClientScript',),// .....),// .....),
- In any of your view files just include your less file using
Adding the above in your
layouts/main.php will render
<web-application-root>/less-files/site.less file as
site.css delivered from your assets.