为 ilollar 答案编辑(同样的问题)我有 app.coffee :
pp.configure ->
publicDir = "#{__dirname}/public"
app.set "views", viewsDir
app.set "view engine", "jade"
app.use(stylus.middleware debug: true, src: viewsDir, dest: publicDir, compile: compileMethod)
app.use(express.static(publicDir))
compileMethod = (str, path) ->
stylus(str)
.set('filename', path)
.set('compress', true)
app.get "/pag",(req,res) ->
res.render "pag",
title: "test",
在 /stylesheet/pag.jade 中:
...
link(rel='stylesheet', href='pag/css/bootstrap.min.css')
...
当我转到“myserver:9090/pag”时,页面没有加载 bootstrap.min.css。我收到以下错误:
source :(my folder of proyects)/views/pag/css/bootstrap.min.styl
dest : (my folder of proyects)/public/pag/css/bootstrap.min.css
read : (my folder of proyects)/views/pag/css/bootstrap.min.styl
Error: ENOENT, open '(my folder)/views/pag/css/bootstrap.min.styl'
我哪里错了?我可能错过了一些东西..有什么想法吗?