Using LESS with Assetic without Node.js

If you want to use Assetic with LESS support in shared hosting or in a server without node.js you might want to try lessphp.

Note:

The installation is quite simple.

  1. Add lessphp to your Composer dependencies (php composer.phar require oyejorge/less.php)
  2. Update your Symfony configuration (usually app/config/config.yml):

    assetic:
        filters:
          cssrewrite: ~
        lessphp:
              apply_to: "\.less$"
            file:   %kernel.root_dir%/../vendor/oyejorge/less.php/lessc.inc.php
    
  3. Include your less files via twig into your templates, and you’re done!

Keep in mind that lessphp may not include all the new features of lesscss but it is possible to use it in most situations.

Related articles:

  • [How to use Assetic in Shared Hosting][3]