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

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:

<?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.

Resources

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

5 Responses to Yii LESS Extension

  1. I really like it when people get together and share opinions.
    Great site, continue the good work!

  2. For hottest information you have to go to see world wide web and on internet I found this website as a
    most excellent web site for newest updates.

  3. Excellent site you have got here.. It’s difficult to find quality writing
    like yours these days. I honestly appreciate individuals like you!

    Take care!!

  4. I was wondering if you ever considered changing the layout of your blog?
    Its very well written; I love what youve got to say.
    But maybe you could a little more in the way of content so
    people could connect with it better. Youve got an awful lot of text for
    only having 1 or 2 pictures. Maybe you could space it out better?

  5. Greetings I am so happy I found your website, I really found you by error, while I was searching on Askjeeve for something else, Anyhow I am here now and would just like to say thank you for a remarkable post and a all round entertaining
    blog (I also love the theme/design), I don’t have time to read it all at the
    moment but I have saved it and also added your RSS
    feeds, so when I have time I will be back to read a great deal more, Please do keep up
    the excellent job.

Leave a Reply

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