Download the PHP package ikimea/lessphp without Composer
On this page you can find all versions of the php package ikimea/lessphp. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ikimea/lessphp
More information about ikimea/lessphp
Files in ikimea/lessphp
Package lessphp
Short Description lessphp is a compiler for LESS written in PHP.
License MIT GPL-3.0
Homepage http://leafo.net/lessphp/
Informations about the package lessphp
lessphp v1.0-dev
http://lessphp.ikimea.com/lessphp
lessphp
is a compiler for LESS written in PHP. The documentation is great,
so check it out: http://lessphp.ikimea.com/docs/.
Here's a quick tutorial:
How to use in your PHP project
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 bin/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.
How to use from the command line
An additional script has been included to use the compiler from the command line. In the simplest invocation, you specify an input file and the compiled css is written to standard out:
$ bin/plessc input.less > output.css
Using the -r flag, you can specify LESS code directly as an argument or, if the argument is left off, from standard in:
$ bin/plessc -r "my less code here"
Finally, by using the -w flag you can watch a specified input file and have it compile as needed to the output file:
$ plessc -w input-file output-file
Errors from watch mode are written to standard out.
The -f flag sets the output formatter. For example, to compress the output run this:
$ bin/plessc -f=compressed myfile.less
For more help, run bin/plessc --help
LessPHP is a leafo initiative. See also the list of contributors.