In my GruntFile.js
I have bower
task:
bower: {
dev: {
dest: 'lib'// will get stuff from 'bower_components' to 'lib' folder
}
},
So when I do: grunt bower
it transforms some stuff from bower_component
folder to lib
.. so I end up having files like: angular.js
in the /lib
.
But it does not copy "angular.min.js"
, which sits in bower_component
.
Q: How can I configure grunt bower task to copy minified v of files too?
I do not want to put minify/uglify tasks to GruntFile just yet. Since those files are already minified in bower_components
.
You should use the bower task just to download bower components and add a copy task to move files around 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 just what the **.min.js
files.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With