2016-05-09 82 views
3

當我複製一個模板,報價this.copyTpl自耕農打印代碼cacharter,而不是報價...這裏什麼IM在index.js做 自耕農打印碼字符

this.dependencies["fontawesome"] = "4.2"; 
this.dependencies["jQuery"] = "~1.11.1"; 
this.dependencies["responsive-nav"] = "1.0.34"; 
this.dependencies["superfish"] = "1.7.5"; 

this.dep = JSON.stringify(this.dependencies); 

console.log(this.dep) 
display 
{"fontawesome":"4.2","jQuery":"~1.11.1","responsive-nav":"1.0.34","superfish":"1.7.5"} 

this.fs.copyTpl(
      this.templatePath('_bower.json'), 
      this.destinationPath(projectPath +'/bower.json'),{ 
       projectName: _.slugify(this.project_name), 
       dependencies: this.dep 
      } 
     ); 

結果文件

{"fontawesome":"4.2","jQuery":"~1.11.1","responsive-nav":"1.0.34","superfish":"1.7.5"}, 

爲什麼會出現這種情況,我需要額外的配置?我在想什麼?感謝您的幫助

回答

6

<%=傳遞給它的轉義值以防止XSS。

要輸出原始輸入,您需要使用​​3210模板標籤。

上在http://ejs.co/

+0

感謝您的幫助使用約曼的模板引擎完整的文檔;) –

+0

@PabloEnanoskiAraya如果回答你的問題,你可以通過點擊旁邊的選中標記我的回答是公認的設置這個答案。 –