Make a grunt bower to get the version with "bower_components"

In my GruntFile.js , I have a bower task:

 bower: { dev: { dest: 'lib'// will get stuff from 'bower_components' to 'lib' folder } }, 

So, when I do this: grunt bower it converts some things from bower_component to the lib .. folder, so I get files like: angular.js in / lib .

But it does not copy "angular.min.js" , which is located in bower_component .

Q: How to configure the grunt bower task to copy v mini files too?

I don't want to set minify / uglify tasks in the GruntFile yet. Because these files are already reduced in bower_components .

+5
source share
1 answer

You should use the bower task only to load tower components and add a copy task to move the files as needed.

Install grunt-contrib-copy

 npm install grunt-contrib-copy --save-dev 

And use it in your grunt file:

 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'}, ], }, } }); 

You can configure it to copy only those **.min.js .

+2
source

Source: https://habr.com/ru/post/1215255/


All Articles