node package manager
It’s your turn. Help us improve JavaScript. Take the 2017 JavaScript Ecosystem Survey »



LESS middleware built on compile-middleware.


var lessware = require('compile-mw-less');
    filename  : /(?:\/styles\/)(.*)\.css/i, // Capture group 1 will be used 
    src       : '/path/to/source',
    maxAge    : 86400                       // Optional, HTTP Cache Control MaxAge 
    // Render Options to LESS Parser, Optional 
    compress  : 'auto',
             // 'auto' will turn compress on compress when requested file  
             // ends with .min.css or -min.css 
             // Other optional value are: true/false, default 'auto' 
    yuicompress: false,                     // YUICompress, off by default 
    optimization: 0,                        // Specify LESS optimize level 
    dumpLineNumbers: 0,                     // LESS.js debug option 
    paths     : []
             // Specify LESS include paths, src path will be added automatically 

Refer to compile-middleware#Usage for more information.

For information about less render options, please refer

WARNING No not add a g flag to the RegExp, that will broke the filename extraction procedure. It's an V8 Issue


Copyright 2013 Shinohane<>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.