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

  1. Requirements
  2. Usage
  3. TODO
  4. Resources
  5. Changes

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

Requirements

Yii 1.1.8 PHP >= 5.3

Usage

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)
            'destination'=>'/css',
            '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
            'compiler'=>array(
                'compress'=>true,
            ),
        ),
    ),

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

or

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

TODO

Include compilation of scss files

Resources

Changes

  • 2012-10-11

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

1 0
7 followers
697 downloads
Yii Version: 1.1
License: BSD-2-Clause
Category: User Interface
Developed by: n3okill
Created on: May 11, 2012
Last updated: 5 years ago

Downloads

show all

Related Extensions