Warning, /webapps/ocs-webserver/library/lessphp/README.md is written in an unsupported language. File is not indexed.

0001 # lessphp v0.4.0
0002 ### <http://leafo.net/lessphp>
0003 
0004 [![Build Status](https://secure.travis-ci.org/leafo/lessphp.png)](http://travis-ci.org/leafo/lessphp)
0005 
0006 `lessphp` is a compiler for LESS written in PHP. The documentation is great,
0007 so check it out: <http://leafo.net/lessphp/docs/>.
0008 
0009 Here's a quick tutorial:
0010 
0011 ### How to use in your PHP project
0012 
0013 The only file required is `lessc.inc.php`, so copy that to your include directory.
0014 
0015 The typical flow of **lessphp** is to create a new instance of `lessc`,
0016 configure it how you like, then tell it to compile something using one built in
0017 compile methods.
0018 
0019 The `compile` method compiles a string of LESS code to CSS.
0020 
0021 ```php
0022 <?php
0023 require "lessc.inc.php";
0024 
0025 $less = new lessc;
0026 echo $less->compile(".block { padding: 3 + 4px }");
0027 ```
0028 
0029 The `compileFile` method reads and compiles a file. It will either return the
0030 result or write it to the path specified by an optional second argument.
0031 
0032 ```php
0033 <?php
0034 echo $less->compileFile("input.less");
0035 ```
0036 
0037 The `compileChecked` method is like `compileFile`, but it only compiles if the output
0038 file doesn't exist or it's older than the input file:
0039 
0040 ```php
0041 <?php
0042 $less->checkedCompile("input.less", "output.css");
0043 ```
0044 
0045 If there any problem compiling your code, an exception is thrown with a helpful message:
0046 
0047 ```php
0048 <?php
0049 try {
0050   $less->compile("invalid LESS } {");
0051 } catch (exception $e) {
0052   echo "fatal error: " . $e->getMessage();
0053 }
0054 ```
0055 
0056 The `lessc` object can be configured through an assortment of instance methods.
0057 Some possible configuration options include [changing the output format][1],
0058 [setting variables from PHP][2], and [controlling the preservation of
0059 comments][3], writing [custom functions][4] and much more. It's all described
0060 in [the documentation][0].
0061 
0062 
0063  [0]: http://leafo.net/lessphp/docs/
0064  [1]: http://leafo.net/lessphp/docs/#output_formatting
0065  [2]: http://leafo.net/lessphp/docs/#setting_variables_from_php
0066  [3]: http://leafo.net/lessphp/docs/#preserving_comments
0067  [4]: http://leafo.net/lessphp/docs/#custom_functions
0068 
0069 
0070 ### How to use from the command line
0071 
0072 An additional script has been included to use the compiler from the command
0073 line. In the simplest invocation, you specify an input file and the compiled
0074 css is written to standard out:
0075 
0076     $ plessc input.less > output.css
0077 
0078 Using the -r flag, you can specify LESS code directly as an argument or, if 
0079 the argument is left off, from standard in:
0080 
0081     $ plessc -r "my less code here"
0082 
0083 Finally, by using the -w flag you can watch a specified input file and have it 
0084 compile as needed to the output file:
0085 
0086     $ plessc -w input-file output-file
0087 
0088 Errors from watch mode are written to standard out.
0089 
0090 The -f flag sets the [output formatter][1]. For example, to compress the
0091 output run this:
0092 
0093     $ plessc -f=compressed myfile.less
0094 
0095 For more help, run `plessc --help`
0096