Yii LESS Extension

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.

Extension Home: Click Here
Download: Click Here
Project Repository: Click Here


  • Download and extract the extension package to protected/extensions/yiiless directory of your application.
  • Make the following modifications to your protected/config/main.php under the components section of the config:
  • array(
      // .....
        // .....
        'clientScript' => array(
          'class' => 'ext.yiiless.components.YiiLessCClientScript',
        // .....
      // .....
  • In any of your view files just include your less file using Yii::app()->clientScript->registerLessFile("full-or-relative-path-to-your-less-file/style.less");


<?php Yii::app()->clientScript->registerLessFile(Yii::getPathOfAlias("less-files/site.less"); ?>

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.


This entry was posted in PHP, Programming, Yii Framework and tagged , , , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *