Installation
sudo npm install less-middleware
Options
Option | Description | Default |
---|
force | Always re-compile less files on each request. | false |
---|
once | Only check for need to recompile once after each server restart. Useful for reducing disk i/o on production. | false |
---|
debug | Output any debugging messages to the console. | false |
---|
src | Source directory containing the .less files. Required. | |
---|
dest | Desitnation directory to output the compiled .css files. | <src> |
---|
compress | Compress the output being written to the *.css files. | false |
---|
optimization | Desired level of LESS optimization. Optionally 0 , 1 , or 2 | 0 |
---|
Examples
Connect
var lessMiddleware = require('less-middleware');
var server = connect.createServer(
lessMiddleware({
src: __dirname + '/public',
compress: true
}),
connect.staticProvider(__dirname + '/public')
);
Express
var lessMiddleware = require('less-middleware');
var app = express.createServer();
app.configure(function () {
// Other configuration here...
app.use(lessMiddleware({
src: __dirname + '/public',
compress: true
}));
app.use(express.staticProvider(__dirname + '/public'));
});