diff --git a/README.md b/README.md index f22c52aa..1a3688e6 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ Please note, there are a few unsupported LESS features: Installation --- -You can install the library with composer or manually. +You can install the library with Composer or manually. #### Composer @@ -51,7 +51,7 @@ $ php composer.phar install #### Manually From Release -Step 1. [Download the latest release](https://github.com/oyejorge/less.php/releases) and upload the php files to your server. +Step 1. [Download the latest release](https://github.com/oyejorge/less.php/releases) and upload the PHP files to your server. Step 2. Include the library: @@ -63,7 +63,7 @@ require_once '[path to less.php]/Less.php'; Step 1. [Download the source](https://github.com/oyejorge/less.php/archive/master.zip) and upload the files in /lib/Less to a folder on your server. -Step 2. Include the library and register the Autoloader +Step 2. Include the library and register the autoloader ```php require_once '[path to less.php]/Autoloader.php'; @@ -82,7 +82,7 @@ $css = $parser->getCss(); ``` -#### Parsing Less Files +#### Parsing LESS Files The parseFile() function takes two arguments: 1. The absolute path of the .less file to be parsed @@ -95,8 +95,8 @@ $css = $parser->getCss(); ``` -#### Handling Invalid Less -An exception will be thrown if the compiler encounters invalid less +#### Handling Invalid LESS +An exception will be thrown if the compiler encounters invalid LESS. ```php try{ @@ -110,7 +110,7 @@ try{ #### Parsing Multiple Sources -less.php can parse multiple sources to generate a single css file +less.php can parse multiple sources to generate a single CSS file. ```php $parser = new Less_Parser(); @@ -131,7 +131,7 @@ $imported_files = $parser->allParsedFiles(); #### Compressing Output -You can tell less.php to remove comments and whitespace to generate minimized css files. +You can tell less.php to remove comments and whitespace to generate minimized CSS files. ```php $options = array( 'compress'=>true ); @@ -142,8 +142,8 @@ $css = $parser->getCss(); #### Getting Variables You can use the getVariables() method to get an all variables defined and -their value in a php associative array. Note than less have to be previously -compiled +their value in a php associative array. Note that LESS has to be previously +compiled. ```php $parser = new Less_Parser; $parser->parseFile( '/var/www/mysite/bootstrap.less'); @@ -155,7 +155,7 @@ $variables = $parser->getVariables(); #### Setting Variables -You can use the ModifyVars() method to customize your css if you have variables stored in php associative arrays +You can use the ModifyVars() method to customize your CSS if you have variables stored in PHP associative arrays. ```php $parser = new Less_Parser(); @@ -166,7 +166,7 @@ $css = $parser->getCss(); #### Import Directories -By default, less.php will look for @imports in the directory of the file passed to parsefile(). +By default, less.php will look for @imports in the directory of the file passed to parseFile(). If you're using parse() or if @imports reside in different directories, you can tell less.php where to look. ```php @@ -180,12 +180,12 @@ $css = $parser->getCss(); Caching --- -Compiling less code into css is a time consuming process, caching your results is highly recommended. +Compiling LESS code into CSS is a time consuming process, caching your results is highly recommended. #### Caching CSS -Use the Less_Cache class to save and reuse the results of compiled less files. -This method will check the modified time and size of each less file (including imported files) and regenerate a new css file when changes are found. +Use the Less_Cache class to save and reuse the results of compiled LESS files. +This method will check the modified time and size of each LESS file (including imported files) and regenerate a new CSS file when changes are found. Note: When changes are found, this method will return a different file name for the new cached content. ```php @@ -209,8 +209,8 @@ $compiled = file_get_contents( '/var/www/writable_folder/'.$css_file_name ); #### Parser Caching less.php will save serialized parser data for each .less file if a writable folder is passed to the SetCacheDir() method. -Note: This feature only caches intermediate parsing results to improve the performance of repeated css generation. -Your application should cache any css generated by less.php. +Note: This feature only caches intermediate parsing results to improve the performance of repeated CSS generation. +Your application should cache any CSS generated by less.php. ```php $options = array('cache_dir'=>'/var/www/writable_folder'); @@ -221,11 +221,11 @@ $css = $parser->getCss(); You can specify the caching technique used by changing the ```cache_method``` option. Supported methods are: * ```php```: Creates valid PHP files which can be included without any changes (default method). -* ```var_export```: Like "php", but using PHPs ```var_export()``` function without any optimizations. +* ```var_export```: Like "php", but using PHP's ```var_export()``` function without any optimizations. It's recommended to use "php" instead. * ```serialize```: Faster, but pretty memory-intense. * ```callback```: Use custom callback functions to implement your own caching method. Give the "cache_callback_get" and - "cache_callback_set" options with callables (see PHPs ```call_user_func()``` and ```is_callable()``` functions). less.php + "cache_callback_set" options with callables (see PHP's ```call_user_func()``` and ```is_callable()``` functions). less.php will pass the parser object (class ```Less_Parser```), the path to the parsed .less file ("/some/path/to/file.less") and an identifier that will change every time the .less file is modified. The ```get``` callback must return the ruleset (an array with ```Less_Tree``` objects) provided as fourth parameter of the ```set``` callback. If something goes wrong, @@ -238,7 +238,7 @@ Source Maps Less.php supports v3 sourcemaps #### Inline -The sourcemap will be appended to the generated css file. +The sourcemap will be appended to the generated CSS file. ```php $options = array( 'sourceMap' => true ); @@ -264,7 +264,7 @@ $css = $parser->getCss(); 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: +In the simplest invocation, you specify an input file and the compiled CSS is written to standard out: ``` $ lessc input.less > output.css @@ -313,7 +313,7 @@ Use the built-in compiler to: - set any built-in LESS variable: for example `@footer_bg_color: black;` sets the background color of the footer to black - use built-in mixins: - add a custom font: `.include-custom-font(@family: arial,@font-path, @path: @custom-font-dir, @weight: normal, @style: normal);` -The compiler can also be download as [plugin](http://wordpress.org/plugins/wp-less-to-css/) +The compiler can also be downloaded as [plugin](http://wordpress.org/plugins/wp-less-to-css/) #### WordPress @@ -329,8 +329,8 @@ Transitioning from Leafo/lessphp --- Projects looking for an easy transition from leafo/lessphp can use the lessc.inc.php adapter. To use, [Download the less.php source code](https://github.com/oyejorge/less.php/archive/master.zip) and unzip the files into your project so that the new 'lessc.inc.php' replaces the existing 'lessc.inc.php'. -Note, the 'setPreserveComments' will no longer have any effect on the compiled less. +Note, the 'setPreserveComments' will no longer have any effect on the compiled LESS. Credits --- -less.php was originally ported to php by [Matt Agar](https://github.com/agar) and then updated by [Martin Jantošovič](https://github.com/Mordred). +less.php was originally ported to PHP by [Matt Agar](https://github.com/agar) and then updated by [Martin Jantošovič](https://github.com/Mordred).