2017 © Pedro Peláez
 

library yii-eassetmanager

Extended Asset Manager Compiles .less file(s) on-the-fly and publishes output .css file

image

inpassor/yii-eassetmanager

Extended Asset Manager Compiles .less file(s) on-the-fly and publishes output .css file

  • Friday, July 29, 2016
  • by Inpassor
  • Repository
  • 2 Watchers
  • 4 Stars
  • 17 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

EAssetManager class file., (*1)

Extended Asset Manager Compiles .less file(s) on-the-fly and publishes output .css file, (*2)

Author: Inpassor inpassor@yandex.com . Link: https://github.com/Inpassor/yii-EAssetManager . Version: 0.3 (2013.10.24) ., (*3)

INSTALLATION

Install with composer:

composer require inpassor/yii-eassetmanager

Manual install:

  1. Copy EAssetManager.php to /protected/vendor/ directory
  2. Add or replace the assetManager component in /protected/config/main.php like that:
    'components'=>array(

        ...

        'assetManager'=>array(
            'class'=>'EAssetManager',
            'lessCompile'=>true,
            'lessCompiledPath'=>'application.assets.css',
            'lessFormatter'=>'compressed',
            'lessForceCompile'=>false,
        ),

        ...

    ),

See code of EAssetManager.php to read description of public properties., (*4)

  1. CHMOD 'lessCompiledPath' directory to 0777 in order to create new files there by EAssetManager.
  2. Optional: enable Yii caching. Otherwise, EAssetManager will create (or use existing) directory /protected/runtime/cache/ and store cache data there. You can override this path by setting public property 'cachePath'.

USAGE

Just publish .less file with assetManager like that:, (*5)

$css = CHtml::asset(Yii::app()->basePath.'/vendors/bootstrap/less/bootstrap.less');

That's all :), (*6)

Also it might be useful to pre-compile .less files. For example, to make command which compiles .less files in background. In this case you can use "lessCompile" method:, (*7)

Yii::app()->assetManager->lessCompile(Yii::app()->basePath.'/vendors/bootstrap/less/bootstrap.less');

Output .css file will be stored under 'lessCompiledPath' directory. And then add already compiled file in your application:, (*8)

$css = CHtml::asset(Yii::app()->assetManager->lessCompiledPath.'/bootstrap.css');

The Versions

29/07 2016

dev-master

9999999-dev

Extended Asset Manager Compiles .less file(s) on-the-fly and publishes output .css file

  Sources   Download

MIT

The Requires

 

by Avatar Inpassor

css yii asset manager less

29/07 2016

v0.3

0.3.0.0

Extended Asset Manager Compiles .less file(s) on-the-fly and publishes output .css file

  Sources   Download

MIT

The Requires

 

by Avatar Inpassor

css yii asset manager less