2.0.1 • Published 8 years ago

koa-less2x v2.0.1

Weekly downloads
2
License
MIT
Repository
github
Last release
8 years ago

koa-less2x

Less2 middleware for koa2. A wrapper of less-middleware.

Installation

$ npm install koa-less2x

Example

var less = require('koa-less2x');
var serve = require('koa-static');
var koa = require('koa');
var app = new koa();

app.use(less('./public'));

app.use(serve('./public'));

app.listen(3000);

Options

See the less middleware document.

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:

Example of use:

var path=require('path');
app.use(require('koa-less2x')('/my/less/source/path', {
  dest: path.join(__dirname, 'public')
}));

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 koa-static):

var lessMiddleware = require('koa-less2x');
var app = new koa();
app.use(lessMiddleware(__dirname + '/public'));
app.use(require('koa-static')(__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.

License

MIT

2.0.1

8 years ago

2.0.0

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago

0.1.0

8 years ago