LESS + CakePHP, best buddies

LESS takes CSS to a whole new level by extending it with dynamic behavior (think of working with variables, functions or mixins directly in CSS).

Here below a few quick notes about integrating LESS with CakePHP.

There are a few different ways of adding LESS support to a CakePHP project, but by far the best one I know is to first install the asset_compress plugin by Mark Story and then to add a custom filter to it. The asset_compress plugin actually supports LESS out of the box, the only issue I have with it is that running Node.js just to parse LESS stylesheets seems like an overkill. I much prefer to use lessphp implementation instead of the Node.js implementation of LESS.

The good news is that a plugin exists that makes it very easy to add a lessphp filter to asset_compress.
It was created by Frank de Graaf (Phally) and I had the opportunity to rewrite it to support the latest asset_compress v0.4.

Check it out at github and follow installation instructions there.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">