On-the-fly LESS-to-CSS conversion middleware.

Usage no npm install needed!

<script type="module">
  import expressLess from '';


Express LESS

On-the-fly LESS-to-CSS conversion middleware.

For more information on LESS visit


$ npm install express-less


var express = require('express'),
    expressLess = require('express-less');

var app = express();
app.use('/less-css', expressLess(__dirname + '/less'));

Now request to /less-css/styles.css will return rendered contents of ./less/styles.less.

Additionally, you can ask LESS to compress the result:

app.use('/less-css', expressLess(__dirname + '/less', { compress: true }));

For detail information on LESS errors use the debug option, e.g.

// Enable error reporting permanently
app.use('/less-css', expressLess(__dirname + '/less', { debug: true }));

// or only for development environment
app.use('/less-css', expressLess(__dirname + '/less', {
    debug: app.get('env') == 'development'


Copyright (C) 2015 Andrew A. Usenok <>

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see