Stylus 和 Express - 样式表修改后不会重新编译
我在 Mac OS X 上运行最新版本的 Node。我已将 Express 与 Stylus 一起安装。还有最新版本。
当我修改我的 .styl 文件时,Stylus 不会重新编译它们。我该如何解决这个问题?
重新编译我的 .styl 文件的唯一解决方案是删除已编译的 .css 文件...重新启动我的应用程序,或执行清除缓存-refresh (CMD + Shift + R) 不会导致重新编译。
这是我的应用程序配置的转储。这与您使用可执行文件创建新的 Express 应用程序基本上相同...
app.configure(function ()
{
this.set("views", __dirname + "/views");
this.set("view engine", "jade");
this.use(express.bodyParser());
this.use(express.methodOverride());
this.use(express.static(__dirname + '/public'));
this.use(require("stylus").middleware({
src: __dirname + "/public",
compress: true
}));
this.use(this.router);
});
我的 .styl 和编译的 .css 文件都位于 [application ]\public\stylesheets\
I am running latest version of Node on Mac OS X. I've installed Express together with Stylus. Also the latest versions.
Stylus is not re-compiling my .styl files, when I modify them. How can I fix this?
The only solution to getting my .styl files re-compiled, is to delete the compiled .css files... re-starting my application, or doing a clear-cache-refresh (CMD + Shift + R) is not resulting a re-compile.
Here's a dump of my application configuration. It's basically the same as when you create a new express application with the executable...
app.configure(function ()
{
this.set("views", __dirname + "/views");
this.set("view engine", "jade");
this.use(express.bodyParser());
this.use(express.methodOverride());
this.use(express.static(__dirname + '/public'));
this.use(require("stylus").middleware({
src: __dirname + "/public",
compress: true
}));
this.use(this.router);
});
Both my .styl and the compiled .css files are located in [application]\public\stylesheets\
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
将
static()
放在手写笔中间件下方。Put
static()
below the stylus middleware.现在可能为时已晚,但我刚刚在这上面花了几个小时(T__T),我认为这是玉或类似的东西的错误。我会解释一下自己:
使用 server.js:
和 index.jade: 中
的这段代码,它可以完美运行。问题是当链接标签中有:
然后它根本没有重新编译。
我希望这会有所帮助
It can be too late now, but I've just passed some hours ( T__T ) on this, and I think it's a bug of jade or something like that. I'll explain myself:
With this code in server.js:
and in the index.jade:
it works perfectly. The problem was when in the link tag there was:
and then it was not recompiling at all.
I hope this will help