Gruntjs 在开发中使用grunt processhtml的策略

Gruntjs 在开发中使用grunt processhtml的策略,gruntjs,Gruntjs,在开发环境中应该如何使用grunt processhtml 例如,在index.html中,我将在构建时为angular加载partials: <!-- build:include:dist views/template-main.html --> <script type="text/ng-template" id="views/template-main.html"> --> </script> <!-- /build --> 如何仅

在开发环境中应该如何使用
grunt processhtml

例如,在
index.html
中,我将在构建时为angular加载partials:

<!-- build:include:dist views/template-main.html -->
<script type="text/ng-template" id="views/template-main.html"> -->

</script>
<!-- /build -->
如何仅获取由
grunt-service提供的开发环境(
app/
)中的沙盒脚本

我是否应该每次执行
grunt构建
,而不是
grunt
/
节点
app/
的内容提供服务,以某种方式将其更改为服务于开发构建(即
dist/

或者我应该将这些
grint processhtml
指令(或任何预处理器)写入另一个文件中,例如
pre.index.html
,并将其构建为
index.html

否则,如果运行
grunt processhtml
,它将删除指令;如果不运行,浏览器显然会忽略
grunt processhtml
指令并加载这两个脚本


(这是一个由Yeoman搭建的AngularJS项目,但这是一个通用的grunt过程HTML问题)

我想我误解了如何使用grunt

我认为最好添加不同的构建目标,例如
dev
production
等,而不仅仅是使用
app/
dist

这包括建立不同的目标,设定不同的服务目标

一个很好的解释:

<!-- @if NODE_ENV='production' -->
<script src=" production script "></script>
<!-- @endif -->
<!-- @if NODE_ENV='dev' -->
<script src=" sandbox script "></script>
<!-- @endif -->