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 -->