Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/chosecz/koa-less
Less middleware for Koa
https://github.com/chosecz/koa-less
Last synced: 2 months ago
JSON representation
Less middleware for Koa
- Host: GitHub
- URL: https://github.com/chosecz/koa-less
- Owner: chosecz
- License: mit
- Created: 2014-01-10T09:29:39.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2014-07-24T07:43:12.000Z (over 10 years ago)
- Last Synced: 2024-10-01T14:59:15.478Z (2 months ago)
- Language: JavaScript
- Size: 190 KB
- Stars: 4
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-koa - koa-less - LESS中间件。 ![](https://img.shields.io/github/stars/chosecz/koa-less.svg?style=social&label=Star) ![](https://img.shields.io/npm/dm/koa-less.svg?style=flat-square) (仓库 / 中间件)
README
# koa-less
Less middleware for Koa
## Installation
```js
$ npm install koa-less
```## Example
```js
var less = require('koa-less');
var serve = require('koa-static');
var koa = require('koa');
var app = koa();app.use(less('./public'));
app.use(serve('./public'));
app.listen(3000);
```## Options
See [the less middleware document](https://github.com/emberfeather/less.js-middleware).
Example of use:
```js
var path=require('path');
app.use(require('koa-less')('/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):
```js
var lessMiddleware = require('koa-less');
var app = 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