Categories
PHP Programming Yii Framework

Yii LESS Extension

Yii Less Extension gives a simple way to include LESS files in your Yii view files.
Extension Home: Click Here
Download: Click Here
Project Repository: Click Here
Support Forum: Click Here

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

Usage

  • 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(
      // .....
      'components'=>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");

Eg:

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.

Resources