Yii 1.1: jless

JLess is a extension to easily manage less files in Yii applications

This class provides direct compilation of less to files to css extending from CClientscript and registering css files the normal way that yii does.


Yii 1.1.8 PHP >= 5.3


Copy -Copy files under extension folder

Configuration --config/main.php

// application components
'components' => array(
    'clientScript' => array(
        'class' => 'ext.JLess.JLessCClientScript',      //Extend CClientScript
        'jLessOptions' => array(
            'vendor' => 'agar', //Less-(leafo or agar)
            'forceCompile'=>false,  //Enables force compiling, Atention file will always be compiled when it had changes
            'subfolder'=>true,      //Option necessary for loading the files, we need to know if the application is inside one subfolder or not (true (default) or false)
            //You can include options directly to the compiler
            //This options are related directly with the compiler that you choose

Usage -Use it like you use to include a css file

Yii::app()->clientScript->registerLessFile(Yii::app()->request->baseUrl . '/less/mystyles.less'); //If you want to save in a generic place defined in config


Yii::app()->clientScript->registerLessFile(Yii::app()->theme->baseUrl . '/less/mystyles.less','',Yii::app()->theme->baseUrl.'/css/mystyles.css'); //If you want to save in a specific place like under a folder inside theme


Include compilation of scss files



  • 2012-10-11

    Added an option to verify if the application is inside one folder

Be the first person to leave a comment

Please to leave your comment.

Create extension