My grunt.js has a typical minification task:
min: {
dist: {
src: ['dist/precook.js'],
dest: 'dist/precook.min.js'
}
}
What is the simplest way to have multiple dest files? I’d like to minify into:
- dist/precook.min.js
- example/js/vendor/precook.min.js
The built-in min task doesn’t appear to support multiple destinations, so I assume this can be achieved via a simple “copy” task. Can someone please point me in the right direction?
I’d use grunt-contrib-copy plugin:
Install with npm:
Modify
grunt.js(add copy task definition and load copy plugin):Optionally register
copyin to grunt’s default task.The added beauty here is that you can now perform all other copy tasks as well. Even patterns are supported, like copy all minified files (
'dist/*.min.js').