我正在使用 Grunt 自动构建我的网络应用程序。我遇到了一个有趣的问题。我有两个选择:1)grunt:dev
and 2)grunt:build
grunt:dev
只执行与开发相关的基本任务。我的“主要”Angular 模块如下所示:
var myApp= angular.module('myApp', [
"ui.router",
"ui.bootstrap",
"someDependency",
"someDependency2"
]);
当我想要建造时,我就会这样做grunt:build
。我正在使用html2js https://github.com/karlgoldstein/grunt-html2jsgrunt 插件来填充 Angular 缓存。然而,该方法会生成一个new模块不在我的开发工作流程中,称为模板主.
为了使其工作,当我构建时,我需要“主”模块如下所示:
var myApp= angular.module('myApp', [
"ui.router",
"ui.bootstrap",
"templates-main", //<<< NEW DEPENDENCY
"someDependency",
"someDependency2"
]);
有推荐的方法来实现这一点吗?如果包含依赖项,但它不存在,则会导致 Angular 错误。我希望这可以通过 Grunt 实现自动化。
提前致谢