Gruntjs 约曼公司;Grunt,如何只在构建时包含

Gruntjs 约曼公司;Grunt,如何只在构建时包含,gruntjs,yeoman,Gruntjs,Yeoman,我正在使用Yeoman构建一个Angular应用程序 有一部分JavaScript,我只希望在构建时(在dist文件夹中)包含在页面上 是否有某种方法可以告诉在开发过程中运行“grunt服务器”的grunt任务跳过模板的一部分,只将其包含在构建中?这听起来像是一个完美的使用案例 它允许您在HTML中放置某些指令。在您的情况下,remove指令可能就是您想要的: <!-- build:remove --> <p>This will be removed when any p

我正在使用Yeoman构建一个Angular应用程序

有一部分JavaScript,我只希望在构建时(在dist文件夹中)包含在页面上


是否有某种方法可以告诉在开发过程中运行“grunt服务器”的grunt任务跳过模板的一部分,只将其包含在构建中?

这听起来像是一个完美的使用案例

它允许您在HTML中放置某些指令。在您的情况下,
remove
指令可能就是您想要的:

<!-- build:remove -->
<p>This will be removed when any process is done</p>
<!-- /build -->

<!-- build:dist:remove -->
<p>But this one only when doing processhtml:dist</p>
<!-- /build -->
和“监视”部分,以便以后的更改也会触发文件更新:

watch: {
  html: {
    files: ['<%= yeoman.app %>/*.html'],
    tasks: ['processhtml:server']
  }
}
观察:{
html:{
文件:['/*.html'],
任务:['processhtml:server']
}
}

真棒的答案!非常感谢。
watch: {
  html: {
    files: ['<%= yeoman.app %>/*.html'],
    tasks: ['processhtml:server']
  }
}