【发布时间】:2016-09-15 09:41:32
【问题描述】:
我正在做一个前端应用程序,使用:
- RequireJs
- BackboneJs
- 车把
为了将我的模板 html 编译为用于车把的 js,我使用了 Grunt,并在 gruntfile.js 中使用了这些行
handlebars: {
compile: {
options: {
processName: function (fileName) {
return path.basename(fileName, '.handlebars');
},
namespace: "Handlebars.templates",
amd: true
},
files: {
'src/templates/compiled/example.js':'src/templates/raw/example.handlebars'
}
效果很好,因为在我的 example.js 中我有第一行:
define(['handlebars'], function(Handlebars) {
这行似乎是因为amd: true而出现的,因为如果我删除它,它就不起作用。
但问题是,在 Gulp 中如何在编译后的项目中添加这个定义?
【问题讨论】:
标签: backbone.js gruntjs gulp requirejs handlebars.js