Stylus和Express - 样式表在修改时不会重新编译

cll*_*pse 24 stylus node.js express

我在Mac OS X上运行最新版本的Node.我已经将Express与Stylus一起安装了.也是最新版本.

当我修改它们时,Stylus不会重新编译我的.styl文件.我怎样才能解决这个问题?

重新编译我的.styl文件的唯一解决方案是删除已编译的.css文件...重新启动我的应用程序,或者执行clear-cache-refresh(CMD + Shift + R)不会导致重新编译-compile.

这是我的应用程序配置的转储.它与使用可执行文件创建新的快速应用程序时基本相同...

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);
});
Run Code Online (Sandbox Code Playgroud)

我的.styl和编译的.css文件都位于[application]\public\stylesheets\

tjh*_*huk 37

放在static()手写笔中间件下面.

  • 我是菜鸟,我不知道在触控笔中间件下面放置什么样的静电(看起来像).我真的很喜欢视觉. (5认同)
  • 移动这一行:"this.use(express.static(__ dirname +'/ public'));" 在这条线的正上方"this.use(this.router);" (2认同)