3.1.0 • Published 5 years ago

less-middleware v3.1.0

Weekly downloads
17,346
License
MIT
Repository
github
Last release
5 years ago

This middleware was created to allow processing of Less files for Connect JS framework and by extension the Express JS framework.

CircleCI Dependency Status

Installation

npm install less-middleware --save

Usage

lessMiddleware(source, [{options}])

Express

var lessMiddleware = require('less-middleware');

var app = express();
app.use(lessMiddleware(__dirname + '/public'));
app.use(express.static(__dirname + '/public'));

options

The following options can be used to control the behavior of the middleware:

render Options

The options.render is passed directly into the less.render with minimal defaults or changes by the middleware.

The following are the defaults used by the middleware:

Examples

Common examples of using the Less middleware are available in the wiki.

Troubleshooting

My less never recompiles, even when I use {force: true}!

Make sure you're declaring less-middleware before your static middleware, if you're using the same directory, e.g. (with express):

var lessMiddleware = require('less-middleware');

var app = express();
app.use(lessMiddleware(__dirname + '/public'));
app.use(express.static(__dirname + '/public'));

not

var lessMiddleware = require('less-middleware');

var app = express();
app.use(express.static(__dirname + '/public'));
app.use(lessMiddleware(__dirname + '/public'));

IIS

If you are hosting your app on IIS you will have to modify your web.config file in order to allow NodeJS to serve your CSS static files. IIS will cache your CSS files, bypassing NodeJS static file serving, which in turn does not allow the middleware to recompile your LESS files.

3.1.0

5 years ago

3.0.1

6 years ago

3.0.0

6 years ago

2.3.0

6 years ago

2.2.1

7 years ago

2.2.0

8 years ago

2.1.0

8 years ago

2.0.1

9 years ago

2.0.0

9 years ago

1.0.4

10 years ago

1.0.3

10 years ago

1.0.2

10 years ago

1.0.1-beta

10 years ago

1.0.0-beta

10 years ago

0.2.1-beta

10 years ago

0.2.0-beta

10 years ago

0.1.15

10 years ago

0.1.14

11 years ago

0.1.13

11 years ago

0.1.12

11 years ago

0.1.11

11 years ago

0.1.10

11 years ago

0.1.9

11 years ago

0.1.8

12 years ago

0.1.7

12 years ago

0.1.6

12 years ago

0.1.5

12 years ago

0.1.4

12 years ago

0.1.3

12 years ago

0.1.2

12 years ago

0.1.1

12 years ago

0.1.0

12 years ago

0.0.0

12 years ago