lessphp

Resources

New: lessphp 0.3.4-2, includes latest features from less.js 1.3, download now! changelog (April 17th 2012)

About

lessphp is a compiler for LESS written in PHP.

The entire compiler comes in a single includable class, but an additional command line interface to the compiler is included. See the quick start for basic usage.

For an overview of the syntax take a look at the lessphp official documentation.

Follow the author on twitter: @moonscript.

Issues

If you find something that isn’t working right feel free to leave a comment or post on the GitHub issues tracker. If you have any interesting ideas for additions to the language please do suggest them as well. You can also email me if you want.

Demo

Use the live demo to test the compiler using your own code, or click through the example buttons to see various parts of the language.

Edit me ↴

CSS comes here, click compile to build.
· Go to fullscreen version

Download

stable: lessphp-0.3.4-2.tar.gz

repo: http://github.com/leafo/lessphp


lessify: http://leafo.net/lessphp/lessify/

Repository Tracker

Loading...

Quick Start

There are a few ways to interface with the compiler. The easiest is to have it compile a LESS file when the page is requested. The static function less::ccompile, checked compile, will compile the input LESS file only when it is newer than the output file.

<?php
require 'lessc.inc.php';

try {
    lessc::ccompile('input.less', 'out.css');
} catch (exception $ex) {
    exit('lessc fatal error:<br />'.$ex->getMessage());
}

Note that all failures with lessc are reported through exceptions. If you need more control you can make your own instance of lessc.

<?php
require 'lessc.inc.php';

$less = new lessc('path/to/style.less');
file_put_contents('path/to/style.css', $less->parse());

In addition to loading from file, you can also parse from a string like so:

<?php
require 'lessc.inc.php';

$less = new lessc();
$style = '<style type="text/css">'.
    $less->parse('.block { padding: 3 + 4px }').
    '</style>';

Documentation

Full documentation and reference manual can be found on the documentation page.

A list of changes is available on the changelog page.

Plugins

Various lessphp plugins exist for many frameworks:

If you've got one, email me it and I'll post it here.

Comments

If you have a GitHub account, you can post bug reports on the github issues tracker.


generated by sitegen on Wed May 16 13:28:02 2012 · created by leaf corcoran · lessphp is licensed under GPL3/MIT