yeoman print code character in templates

僤鯓⒐⒋嵵緔 提交于 2019-12-10 14:46:10

问题


when i copy a template with this.copyTpl yeoman print code cacharter of quotes and not quotes ...here what im doing in 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
            }
        );

result file

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

why this occurs, i need extra config where?? what i missing ?? thanks for help


回答1:


<%= escape values passed to it to prevent XSS.

To output raw input you need to use the <%- template tags.

Full documentation on the template engine used by Yeoman at http://ejs.co/



来源:https://stackoverflow.com/questions/37106704/yeoman-print-code-character-in-templates

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!