2017-01-02 58 views

回答

1

您可以从master安装handlebars-brunch插件,在brunch-config.js添加

handlebars: { 
    locals: { 
    env: process.env 
    } 
} 

plugins,重命名index.htmlindex.html.hbs和使用它像这样:

<script> 
    alert("{{env.key}}") 
</script> 
+0

它的工作原理,谢谢!值得注意的是,在当前的'master'中,只需命名文件'index.hbs',就可以将其编译为'index.html'。 – fifigyuri

+0

@fifigyuri是的,这是你可以依靠的功能。我只是使用双重扩展语法突出显示。 –