PHP code example of ovidiupop / yii2-less

1. Go to this page and download the library: Download ovidiupop/yii2-less 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/ */

    

ovidiupop / yii2-less example snippets


$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
            ],
        ],
    ],
];

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