在Jade中保留换行符
每当我呈现一个JADE模板时,我会在一行中获得所有的HTML。 这使得在视图源模式下难以阅读。 我如何告诉JADE创build正确缩进的HTML?
这是我的模板:
#application p#docs a(href='/docs/index.html') Documentation p#user-input input#msg(name='msg', size='50') input#submit(name='submit', type='submit', value='Send a Message') ul#messages
在Jade的编译选项设置pretty
真实。
根据你编译的方式,可以用多种方式完成
- 从命令行传递
-P
或--pretty
标志。 - 从快车3.x:
app.locals.pretty = true;
(express 2.x使用了不同的语法: app.set('view options', { pretty: true });
参见迁移指南: https : //github.com/visionmedia/express/wiki/Migrating-from-2 .x-to-3.x )
然后你可以做到以下几点
#test. // <-- notice the dot Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s , when an unknown printer took a galley of type and scrambled
这将产生
<div id="test"> Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s , when an unknown printer took a galley of type and scrambled </div>
- 在单个路由调用中收集多个函数输出,并在nodejs中呈现给html
- 如何在Windows上正确使用node.js child_process.spawn()redirect?
- 节点模块fbgraph:这会处理很多用户吗?
- 伊斯坦布尔代码覆盖检查覆盖我的规范文件,而不是源?
- LocomotiveJS服务器端口更改
- 当使用angular version 2.4.9,typescript&webpack version 2.2.1时,属性'map'在types'Observable <Response>'上不存在
- Node.js – EJS示例
- 如何将用户input从一个js文件传递到另一个
- marklogic用node-client-api保存xml文档?