PHP code example of crisu83 / yii-less

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

    

crisu83 / yii-less example snippets


return array(
  'components'=>array(
    .....
    'less'=>array(
      'class'=>'ext.less.components.LessClientCompiler',
      'files'=>array(
        'less/styles.less'=>'css/styles.css',
      ),
    ),
  ),
);

return array(
  'components'=>array(
    'less'=>array(
      'class'=>'ext.less.components.LessServerCompiler',
      'files'=>array(
        'less/styles.less'=>'css/styles.css',
      ),
      'nodePath'=>'path/to/node.exe',
      'compilerPath'=>'path/to/lessc',
    ),
  ),
);

'less'=>array(
  'class'=>'ext.less.components.LessClientCompiler',
  'files'=>array( // files to compile (relative from your base path)
    'less/styles.less'=>'css/styles.css',
  ),
  'env'=>'production', // compiler environment, either production or development
  'async'=>false, // load imports asynchronous?
  'fileAsync'=>false, // load imports asynchronous when in a page under a file protocol
  'poll'=>1000, // when in watch mode, time in ms between polls
  'dumpLineNumbers'=>'mediaQuery', // enables debugging, set to comments, mediaQuery or all
  'watch'=>true, // enable watch mode?
),

'less'=>array(
  'class'=>'ext.less.components.LessServerCompiler',
  'files'=>array( // files to compile (relative from your base path)
    'less/styles.less'=>'css/styles.css',
  ),
  'basePath'=>'path/to/webroot', // base path, defaults to webroot
  'nodePath'=>'path/to/node.exe', // absolute path to nodejs executable
  'compilerPath'=>'path/to/lessc', // absolute path to lessc
  'strictImports'=>false, // force evaluation of imports?
  'compression'=>false, // enable compression, either whitespace or yui
  'optimizationLevel'=>false, // parser optimization level, set to 0, 1 or 2
  'forceCompile'=>false, // compile files on each request?
),