在Node.js中使用LESS [英] Using LESS with node.js

查看:579
本文介绍了在Node.js中使用LESS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

更少是令人惊叹的,我想使用node.js,因为使用less.js并不是一种很好的性能.我测试目的是在Windows上使用xamp,然后安装node.js,但应在哪里写什么..我安装express.js npm install -g express和更少的npm install -g less

Less is amazing and I want to use to node.js because using less.js is not a good performance. I testing purpos i'm using xamp on windows and I install node.js but where and what i should write.. I install express.js npm install -g express and less npm install -g less

推荐答案

如果您使用的是expressjs,则可以安装

If you're using expressjs you can install

npm install less-middleware

,然后在您的应用程序(app.js)中

and then in your application (app.js)

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

然后您必须通过

app.configure(function(){
  //other configuration here...
  app.use(lessMiddleware({
    src      : __dirname + "/public",
    compress : true
  }));
  app.use(express.static(__dirname + '/public'));
});

现在在您的[appname]/public/stylesheets/custom.less

now in your [appname]/public/stylesheets/custom.less

被翻译成普通的css custom.css

gets translated into regular css custom.css

这篇关于在Node.js中使用LESS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆