LESS compiler in PHP
Documentation
Source on GitHub
Download
lessphp-0.3.8.tar.gz
or
New: lessphp 0.3.8, enhanced performance,
, and bug fixes. !
Changelog (August 18th 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. It will run on PHP 5.1+.
See the quick start for basic usage.
For an overview of the syntax take a look at the lessphp documentation.
Follow the author on twitter for updates: @moonscript.
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.
More Examples:
,
,
,
,
,
Edit me ↴
CSS comes here, click compile to build.
· Go to fullscreen version
Download
stable: lessphp-0.3.8.tar.gz
source: http://github.com/leafo/lessphp
lessify: http://leafo.net/lessphp/lessify/
Composer
If you use Packagist for installing packages, then you can
update your composer.json
like so:
Quick Start
The typical flow of lessphp is to create a new instance of lessc
,
configure it how you like, then tell it to compile something using one built in
compile methods.
The compile
method compiles a string of LESS code to CSS.
The compileFile
method reads and compiles a file. It will either return the
result or write it to the path specified by an optional second argument.
The compileChecked
method is like compileFile
, but it only compiles if the output
file doesn’t exist or it’s older than the input file:
If there any problem compiling your code, an exception is thrown with a helpful message:
The lessc
object can be configured through an assortment of instance methods.
Some possible configuration options include changing the output
format, setting variables from
PHP, and controlling the preservation of
comments, writing custom
functions and much more. It’s all described in the
documentation.
Documentation
A complete 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.
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.
Comments
If you have a GitHub account, you can post bug reports on the github issues
tracker.