This is a LESS CSS compiler written in C++.
A LESS CSS compiler compiles stylesheets in the LESS format to CSS. Read more on http://lesscss.org/
By default, this compiler does not apply formatting to the code. The
CSS in the output contains no whitespace except where necessary. You
can use the -f
option to indent the output. If you need it to be more
user-readable you can use a CSS formatter. Try CSSTidy:
http://csstidy.sourceforge.net/
Parentheses are not required in compound values:
border: @width * 2 solid black;
The spin()
function produces slightly different results.
If compiling from the source checked out with git you first have to run
cmake
To build the compiler just run
make
This searches for a c++ compiler and the libpng and libjpeg libraries. The libraries are not used if not present.
After compiling you will have the binary clessc
. You can run make install
as root to install the binary.
To compile the LESS stylesheet stylesheet.less and write the resulting CSS to stylsheet.css run:
clessc stylesheet.less > stylesheet.css
or:
clessc stylesheet.less -o stylesheet.css
To also generate a source map:
clessc stylesheet.less -o stylesheet.css --source-map=stylesheet.map
Here follows a list of LESS language features and their support status:
-
Variables: yes
- Default variables (variable overriding): yes
- Lazy Evaluation: yes
- Scope: yes
- Variable interpolation
- Selectors: yes
- URLs: yes
- Import statements: yes
- Properties: yes
- Variables: yes
-
Nested rules: yes
- parent selectors
&
: yes - Nested directives: yes
- Comments: yes
- Importing: yes
- Import directives: yes
- File extensions: yes
- inline: no
- parent selectors
-
Mixins
- Selectors in mixins: yes
- Namespaces: yes
- Guarded namespaces: yes
default()
: yes!important
keyword: yes- merge: no
+
append with comma: no+_
append with space: no
-
Parametric Mixins
- Arguments
- default values: yes
- separated by commas/semicolons: yes
- named parameters: yes
@arguments
variable: yes...
rest variable: yes- switch argument: yes
- Return values
- Variables: yes
- Mixins: yes
- Mixin guards: yes
and
keyword: yes- multiple conditions with
,
: yes not
keyword: yesdefault()
: yes
- Detached rulesets: no
- Arguments
-
Operations
- Operators (
+-*/
): yes - Unit conversion: yes *(1px = 1/96 inch)
- Escaping: yes
- Functions: partial
- Operators (
-
Extend
- In ruleset: yes
- In selector: yes
- Quote type in attribute selector: no (
[type='identifier']
does not match[type=identifier]
) - Extend
all
: yes - Attached to interpolated selector: no
- Match only inside
@media
: yes
-
Functions
color
: yesimage-size
: noimage-width
: yesimage-height
: yesconvert
: yesdata-uri
: nodefault
: yesunit
: yesget-unit
: yessvg-gradient
: noescape
: yese
: yes%
: yesreplace
: yeslength
: noextract
: noceil
: yesfloor
: yespercentage
: yesround
: yessqrt
: yesabs
: yessin
: yesasin
: yescos
: yesacos
: yestan
: yesatan
: yespi
: yespow
: yesmod
: yesmin
: yesmax
: yesisnumber
: yesisstring
: yesiscolor
: yesiskeyword
: yesisurl
: yesispixel
: yesisem
: yesispercentage
: yesisunit
: yesisruleset
: norgb
: yesrgba
: yesargb
: yeshsl
: yeshsla
: yeshsv
: yeshsva
: yeshue
: yessaturation
: yeslightness
: yeshsvue
: yeshsvsaturation
: yeshsvvalue
: yesred
: yesgreen
: yesblue
: yesalpha
: yesluma
: yesluminance
: yessaturate
: yesdesaturate
: yeslighten
: yesdarken
: yesfadein
: yesfadeout
: yesfade
: yesspin
: yesmix
: yestint
: yesshade
: yesgreyscale
: yescontrast
: yesmultiply
: yesscreen
: yesoverlay
: yessoftlight
: nohardlight
: yesdifference
: yesexclusion
: yesaverage
: yesnegation
: no