PHP code example of nodejs-php-fallback / less

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

    

nodejs-php-fallback / less example snippets




use NodejsPhpFallback\Less;

// Require the composer autoload in your PHP file if it's not already.
// You do not need to if you use a framework with composer like Symfony, Laravel, etc.
:
header('Content-type: text/css');
echo $less;

// You can also get less code from a string:
$less = new Less('
a {
  color: blue;
  &:hover {
    color: navy;
  }
}
');
// Then write CSS with:
$less->write('path/to/my-css-file.css');
// or get it with:
$cssContents = $less->getResult();

// Pass true to the less constructor to minify the rendered CSS:
$less = new Less('path/to/my-less-file.styl', true);