使grunt凉亭从"bower_components"获得缩小版本

ses*_*ses 5 gruntjs bower

在我的GruntFile.js我的bower任务:

bower: {
    dev: {
        dest: 'lib'// will get stuff from 'bower_components' to 'lib' folder
    }
},
Run Code Online (Sandbox Code Playgroud)

所以,当我这样做:grunt bower它将一些东西从bower_component文件夹转换为lib..所以我最终得到的文件如:angular.js在/ lib.

但它并没有复制"angular.min.js",它就在其中bower_component.

问:我如何配置grunt bower任务来复制缩小的文件v?

我还不想将minify/uglify任务放到GruntFile上.由于这些文件已经缩小了bower_components.

Rem*_*sen 2

您应该仅使用 Bower 任务来下载 Bower 组件并添加复制任务以根据需要移动文件。

安装 grunt-contrib-copy

npm install grunt-contrib-copy --save-dev
Run Code Online (Sandbox Code Playgroud)

并在你的 grunt 文件中使用它:

grunt.loadNpmTasks('grunt-contrib-copy');

grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),  
    /* more tasks... */
    copy: {
      main: {
        files: [
          // includes files within path
          {expand: true, src: ['path/*'], dest: 'dest/', filter: 'isFile'},

          // includes files within path and its sub-directories
          {expand: true, src: ['path/**'], dest: 'dest/'},

          // makes all src relative to cwd
          {expand: true, cwd: 'path/', src: ['**'], dest: 'dest/'},

          // flattens results to a single level
          {expand: true, flatten: true, src: ['path/**'], dest: 'dest/', filter: 'isFile'},
        ],
      },
    }
});
Run Code Online (Sandbox Code Playgroud)

您可以将其配置为仅复制文件**.min.js