From the usemin issues it appears that usemin and useminPrepare support multiple targets in the latest version:
Support multiple targets in useminPrepare:
usemin support:
I've tried using multiple targets with the following configuration:
useminPrepare: {
foo: {
dest: 'fooDist',
src: ['foo/index.html']
},
bar: {
dest: 'barDist',
src: ['bar/index.html']
}
},
usemin: {
foo: {
options: {
assetsDirs : ['fooDist']
},
html: ['fooDist/**/*.html'],
css: ['fooDist/styles/**/*.css']
},
bar: {
options: {
assetsDirs : ['barDist']
},
html: ['barDist/**/*.html'],
css: ['barDist/styles/**/*.css']
}
},
but I receive the following error:
Running "usemin:foo" (usemin) task Warning: Unsupported pattern: foo
Use --force to continue.
Using grunt-usemin 2.0.2
foo/index.html and bar/index.html being the main pages for 2 single page applications.
Thanks for your help!
Do you need both projects to live under the same repository and the same Gruntfile?
You said yourself they are "main pages for 2 single page applications". If you can afford to divide it into two different projects, you'll probably save yourself some pain.
Alternatively, you can group both indexes under a common directory. This is how I use grunt-usemin with two different index files: