Is there a way to run a task twice with different configurations in Grunt? Let’s say I have two sets of source files in my project and I want to minify them into two separate, minified output files. Like this:
project
srcA
fileA1.js
fileA2.js
srcB
fileB1.js
fileB2.js
As the expected result, I would like to see fileA.min.js and fileB.min.js. How can I achieve that, as min only seems to support one set of src and dest attributes?
min: {
dist: {
src: [ 'srcA/*.js'],
dest: 'fileA.min.js'
}
}
Sure
in config object you should configure two min tasks
After that you can create or rewrite default task or even add it to your custom task:
And now you can run tasks: