ovidiupop / yii2-less
This is a Yii2 wrapper extension for PHP port of the official LESS processor http://lesscss.org.
Installs: 6
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:yii2-extension
Requires
- oyejorge/less.php: 1.7.0.*
- yiisoft/yii2: 2.*
This package is auto-updated.
Last update: 2025-03-09 22:28:29 UTC
README
This is a Yii2 wrapper extension for PHP port of the official LESS processor http://lesscss.org
Installation
The preferred way to install this extension is through composer.
Either run
composer require --prefer-dist ovidiupop/yii2-less "~1.0"
or add
"ovidiupop/yii2-less": "~1.0"
to the require section of your composer.json
file.
Usage
Once the extension is installed, simply use it in your config:
$config = [ 'components' => [ 'assetManager' => [ 'converter' => [ 'class' => 'ovidiupop\lessphp\AssetConverter', 'force'=> true, // Optional: On true will convert all .less files. You can make all changes in variable.less 'compress' => true, // Optional: You can tell less.php to remove comments and whitespace to generate minimized css files. 'useCache' => true, // Optional: less.php will save serialized parser data for each .less file. Faster, but more memory-intense. //'cacheDir' => null, // Optional: is passed to the SetCacheDir() method. 'cacheSuffix' => true, // Optional: Filename suffix to avoid the browser cache and force recompiling by configuration changes ], ], ], ];
Now you can specify your less files in asset bundle:
class AppAsset extends AssetBundle { public $basePath = '@webroot'; public $baseUrl = '@web'; public $css = [ 'css/site.less', ]; public $js = [ ]; public $depends = [ ]; }