开发者

Turn on line breaks in Jade source?

开发者 https://www.devze.com 2023-04-04 15:42 出处:网络
Is there a way to turn on line breaks? It would be useful when debugging. I know this topic ( Node.js JADE linebreaks in source?开发者_运维百科 ) says no due to performance, but on your local machine

Is there a way to turn on line breaks? It would be useful when debugging.

I know this topic ( Node.js JADE linebreaks in source?开发者_运维百科 ) says no due to performance, but on your local machine when developing, it should't be a problem.


After a bit of searching I found the solution. Add this to your Express configuration, and it will make Jade tidy up the output:

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 });
});


You can run it through a beautifier for debugging

here's one written for node https://github.com/maxogden/commonjs-html-prettyprinter

0

精彩评论

暂无评论...
验证码 换一张
取 消