Twitter Bootstrap LESS with Node.js&表现 [英] Twitter Bootstrap LESS with Node.js & Express
问题描述
由于 Twitter Bootstrap 2已经出来,我想将其整合到我的Node.js项目中。不幸的是,编译器越少,我无法使其工作。我将所有文件放入公用文件夹,并使用 express -c less newproj
设置一个新项目。并添加了更少的行
Since Twitter Bootstrap 2 is out, I wanted to integrate that into my Node.js project. Unfortunately, there's something wrong with the less compiler and I can't get it to work. I put all files into the public folder and set up a new project with express -c less newproj
. and added the lines for less
less = require('less');
app.use(express.compiler({ src: __dirname + '/public', enable: ['less'] }));
所有节点告诉我的是:
Express server listening on port 3000 in development mode
undefined
在客户端我得到一个500(内部服务器错误)为bootstrap.css文件,应该由lessc编译。
On the client side I get a 500 (Internal Server Error) for the bootstrap.css file, which should be compiled by lessc.
lessc bootstrap.less
工作正常。
任何人都知道如何解决问题?
Anybody knows how to solve the issue?
推荐答案
对于后代,这在最近的Express中发生了很大变化: / p>
For posterity, this has changed a lot in recent Express:
app.use(require('less-middleware')({ src: __dirname + '/public' }));
app.use(express.static(path.join(__dirname, 'public')));
// This is just boilerplate you should already have
app.use(express.bodyParser());
app.use(express.methodOverride());
app.use(app.router);
这篇关于Twitter Bootstrap LESS with Node.js&表现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!