【发布时间】:2015-09-12 16:57:55
【问题描述】:
我使用的是默认的 lessMiddleware 设置,其中 已编译 .css 文件与其源 .less 文件存储在同一文件夹中。
然后我切换到为我的css 和less 文件使用单独的文件夹,并且从那时起我的.less 文件不再被编译成.css(基本上现在路径都是错误的 - 检查底部的调试日志)。我做错了什么?
文件夹结构:
- .....
- 公开
- 款式
- CSS
- 少
- 款式
- .....
- app.js
app.js:
app.use(lessMiddleware(__dirname + '/public/styles/less', {
force: true,
dest: __dirname + '/public/styles/css',
debug: true
}));
app.use(express.static(__dirname + "/public"));
app.get('/', function(req, res, next)
{
res.render('index.ejs');
});
index.ejs:
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="/styles/css/animations.css"/>
<link rel="stylesheet" type="text/css" href="/styles/css/global.css"/>
........
............
减少调试日志:
pathname : /styles/css/animations.css
source : /Users/mothership/testapp/public/styles/less/styles/css/animations.less
destination : /Users/mothership/testapp/public/styles/css/styles/css/animations.css
pathname : /styles/css/global.css
source : /Users/mothership/testapp/public/styles/less/styles/css/global.less
destination : /Users/mothership/testapp/public/styles/css/styles/css/global.css
【问题讨论】: