Grunt useminPrepare - 并非所有CSS文件都包含在构建中(Yeoman)

时间:2015-03-16 15:21:21

标签: build gruntjs yeoman

我在index.html文件中有这个:

<!-- build:css(.) styles/vendor.css -->
    <!-- bower:css -->
    <link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.css" />
    <!-- endbower -->
    <link rel="stylesheet" href="styles/flags.css" />
<!-- endbuild -->>
<!-- build:css(.tmp) styles/main.css -->
    <link rel="stylesheet" href="styles/main.css" />
<!-- endbuild -->

所以我链接到3个CSS文件。当我运行基于Yeoman的grunt构建脚本时,我得到了vendor.css和main.css,但是在vendor.css中,flags.css部分丢失了。

以下是我的gruntfile.js的相关部分:

useminPrepare: {
  html: '<%= yeoman.app %>/index.html',
  options: {
    dest: '<%= yeoman.dist %>',
    flow: {
      html: {
        steps: {
          js: ['concat', 'uglifyjs'],
          css: ['cssmin']
        },
        post: {}
      }
    }
  }
},

// Performs rewrites based on filerev and the useminPrepare configuration
usemin: {
  html: ['<%= yeoman.dist %>/{,*/}*.html'],
  css: ['<%= yeoman.dist %>/styles/{,*/}*.css'],
  options: {
    assetsDirs: ['<%= yeoman.dist %>','<%= yeoman.dist %>/images']
  }
},

0 个答案:

没有答案