有没有办法打开换行符?这在调试时会很有用。
我知道这个主题 ( Node.js JADE linebreaks in source? ) 由于性能原因说不,但是在您的本地机器上开发时,这应该不是问题。
最佳答案
经过一番搜索,我找到了解决方案。将此添加到您的 Express 配置中,它将使 Jade 整理输出:
Express 3.x CoffeeScript
app.configure "development", ->
app.use express.errorHandler()
app.locals.pretty = true
Express 3.x Javascript
app.configure('development', function(){
app.use(express.errorHandler());
app.locals.pretty = true;
});
Express 2.x CoffeeScript
app.configure "development", ->
app.use express.errorHandler()
app.set "view options",
pretty: true
Express 2.x Javascript
app.configure('development', function(){
app.use(express.errorHandler());
app.set('view options', { pretty: true });
});
关于debugging - 在 Jade 源中打开换行符?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7416455/