项目作者: toogle

项目描述 :
On-the-fly LESS-to-CSS conversion middleware
高级语言: JavaScript
项目地址: git://github.com/toogle/express-less.git
创建时间: 2013-08-04T22:11:39Z
项目社区:https://github.com/toogle/express-less

开源协议:GNU General Public License v3.0

下载


Express LESS

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

For more information on LESS visit lesscss.org.

Installation

  1. $ npm install express-less

Usage

  1. var express = require('express'),
  2. expressLess = require('express-less');
  3. var app = express();
  4. app.use('/less-css', expressLess(__dirname + '/less'));

Now request to /less-css/styles.css will return rendered contents of ./less/styles.less.
Note the change of file extension from .less to .css.

Additionally, you can ask LESS to compress the result:

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

You can enable the cache system to improve performance:

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

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

  1. // Enable error reporting permanently
  2. app.use('/less-css', expressLess(__dirname + '/less', { debug: true }));
  3. // or only for development environment
  4. app.use('/less-css', expressLess(__dirname + '/less', {
  5. debug: app.get('env') == 'development'
  6. }));

Tests

  1. $ npm test

License

Copyright (C) 2016 Andrew A. Usenok tooogle@mail.ru

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 http://www.gnu.org/licenses.