Less.js: Parser documentation?

Created on 14 Jan 2013  ·  3Comments  ·  Source: less/less.js

The server side usage references a configuration that can be passed into the Parser:
http://lesscss.org/#usage
var parser = new(less.Parser)({
paths: ['.', './lib'], // Specify search paths for @import directives
filename: 'style.less' // Specify a filename, for better error messages
});

parser.parse('.class { width: (1 + 1) }', function (e, tree) {
tree.toCSS({ compress: true }); // Minify CSS output
});

Is their any documentation as to what that configuration can contain? Can it contain variables?

All 3 comments

the site was recently updated with more info, could you try refreshing the page you link?

variables: no, but the second argument on toCSS can be an object representing a set of variables, e.g.

toCSS({compress:true}, {var1: "theme1", var2: new(tree.Color)('#f01') });

this is undocumented

The documentation does not note the a filename must be declared as of 1.4....

Was this page helpful?
0 / 5 - 0 ratings