LESS.compileStylesheet()

Compile a LESS stylesheet to CSS.

Note that, as you might expect, this will also compile any additional LESS stylesheets referenced using '@import'.

Usage

Hover over inputs/exits for more info.

var LESS = require('machinepack-less');


// Compile a LESS stylesheet to CSS.

LESS.compileStylesheet({

source: '/Users/mikermcneil/Desktop/my-cool-app/assets/styles/importer.less',

importPaths: [ '/Users/mikermcneil/Desktop' ],

minify: false,

}).exec({

// An unexpected error occurred.

error: function (err) {

 

},

// No file exists at the provided `source` path.

doesNotExist: function () {

 

},

// OK.

success: function (css) {

 

},

});

Inputs

source required

The path to the LESS stylesheet (i.e. the entry-point) on disk.

'/Users/mikermcneil/Desktop/my-cool-app/assets/styles/importer.less'
importPaths

An array of paths to folders or specific files to make accessible to @import directives in the LESS stylesheet.

[ '/Users/mikermcneil/Desktop' ]
minify

Whether or not to minify the compiled CSS output.

false

Exits

error

An unexpected error occurred.

doesNotExist

No file exists at the provided `source` path.

success

OK.

'.button { width: 20px; }'