Yeoman/gruntjs angularjs 和文件夹中包含 html 个文件的指令
Yeoman/gruntjs angularjs and directives with html files in the folder
我正在使用 yeoman
作为维护应用程序的工具。因为我有很多指令,所以我没有使用 yeoman
生成指令的标准方式,因此 scripts/directive/name.js
用于代码,views/template_directive.html
用于模板。
我改为这样做:
scripts/directive/my-directive
里面有 js
和 html
文件。
here a screenshot
现在,当我 serve
一切正常时,问题出现在我 运行 build
时。 js
指令在 vendor.js
中结束,但 html 页面仍然指向 scripts/directive/my-directive/template_directive.html
,这不是 dist.
的一部分
我应该做的(如果有更好的选择更受欢迎的话)我应该做的是:
- 复制视图文件夹中的
html
- 修改指令js中的引用
或
- 想办法将
html
文件放在同一文件夹中,也用于 dist(重新创建所有 /directives/<directive>/<template>.html
)
问题是:
- "correct" 解决方案是什么
- 在 g运行tjs 中更改什么命令以使其正常工作。
我喜欢这个(不确定它是否 "correct" 但有效)
将此添加到 copy
部分
..
{
expand: true,
dot: true,
cwd: '<%= yeoman.app %>/scripts/directives',
src: ['*/*.html'],
dest:'<%= yeoman.dist %>/scripts/directives'
}
..
将此添加到 minhtml
conf
files: [{
...
src: [..,'scripts/directives/*/*.html'],
...
}]
我正在使用 yeoman
作为维护应用程序的工具。因为我有很多指令,所以我没有使用 yeoman
生成指令的标准方式,因此 scripts/directive/name.js
用于代码,views/template_directive.html
用于模板。
我改为这样做:
scripts/directive/my-directive
里面有 js
和 html
文件。
here a screenshot
现在,当我 serve
一切正常时,问题出现在我 运行 build
时。 js
指令在 vendor.js
中结束,但 html 页面仍然指向 scripts/directive/my-directive/template_directive.html
,这不是 dist.
我应该做的(如果有更好的选择更受欢迎的话)我应该做的是:
- 复制视图文件夹中的
html
- 修改指令js中的引用
或
- 想办法将
html
文件放在同一文件夹中,也用于 dist(重新创建所有/directives/<directive>/<template>.html
)
问题是:
- "correct" 解决方案是什么
- 在 g运行tjs 中更改什么命令以使其正常工作。
我喜欢这个(不确定它是否 "correct" 但有效)
将此添加到 copy
部分
..
{
expand: true,
dot: true,
cwd: '<%= yeoman.app %>/scripts/directives',
src: ['*/*.html'],
dest:'<%= yeoman.dist %>/scripts/directives'
}
..
将此添加到 minhtml
conf
files: [{
...
src: [..,'scripts/directives/*/*.html'],
...
}]