对于layout.jade,使用环境变量"变量=开发",
我想要
body
// Environment: process.env.Environment || "'Environment' App Setting not found"
生成为
<!-- Environment: Development -->
到目前为止,它正在生成Environment: process.env.Environment || "'Environment' App Setting not found"
我该怎么做?
答案 0 :(得分:0)
body
!= "<!-- Environment: " + (process.env.Environment || "'Environment' App Setting not found") + " -->
为了便于阅读,您还可以将注释与您在上一行中设置的变量连接起来。
body
- var envComment = process.env.Environment || "'Environment' App Setting not found"
!= "<!-- Environment: " + envComment + " -->"
但是,我认为Pug通常无法访问process.env
。您需要将Node.js / Express中的变量作为变量传递给它。有关传递process.env.Environment
变量的信息,请参阅this page的底部。