Parse your LESS files using the GK LESS WordPress plugin
GK LESS (LESS files parser for WordPress) – a simple plugin which allows you to parse your less file(s) from a selected folder into a regular css file(s) in the output directory.
The Compiler state option allows you to enable the compiler. Please remember that the compilation process is time consuming – disable the compiler if it’s not necessary.
The Compile on demand option allows you to enable the compilation only when the user adds in the URL variable recompile=true – it’s useful when you have a live website and you can’t recompile the code on each website request.
In Input directory you have to input the directory that contains the *.less files.
In Output directory you have to input the target folder where you want the .css filesto be created. Of course if created in this way you must manually add the links to the CSS files in the template code. Please remember that existing *.css files in some cases can be overrided by new ones generated from the *.less files.
In the Files to compile field you can specify which *.less files will be compiled – this option is very useful when you have one mail *.less file which imports your other *.less files – then you can specify the filename and only this file will be compiled.
You can also enable the Admin bar button with access to the useful Error Log and the option to disable the LESS parser.
Read more about the LESS language
If you want to learn the LESS we recommend you to read the below resources:
- lesscss.org/ – main page about the LESS language with full language documentation.
- less2css.org/ – great tool for learning LESS – you can directly see the CSS output of your LESS code.
- https://github.com/dziudek/LESS-Mixins – collection of the LESS mixins from our developer.
- getpreboot.com/ – a big collection of LESS mixins.
LESS have parsers for all main programming languages. For WordPress you will most probably be interested in these two parsers:
- phpless – PHP implementation of the LESS parser used in our plugin.
This article was first published