PHP code example of sunnyphp / yii2-less.php

1. Go to this page and download the library: Download sunnyphp/yii2-less.php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

sunnyphp / yii2-less.php example snippets


$config = [
    ...
    'components' => [
		...
        'assetManager' => [
            ...
            'converter' => [
                'class' => 'SunnyPHP\Yii2\LessPHP\AssetConverter',
                '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' => '@web/cache', // Optional: is passed to the SetCacheDir() method. Default cache directory in composer package directory.
                'cacheSuffix' => true, // Optional: Filename suffix to avoid the browser cache and force recompiling by configuration changes
                'outputDir' => '@web/assets', // Optional: Output files directory (watch out: all converted files saves in single directory!)
            ],
			...
        ],
		...
	],
	...
];

class AppAsset extends AssetBundle
{
    public $basePath = '@webroot';
    public $baseUrl = '@web';
    public $css = [
        'css/site.less',
    ];
    public $js = [
    ];
    public $depends = [
    ];
}

php composer.phar 

"sunnyphp/yii2-less.php": "*"