The following config works as expected, but when the //build: { stuff is uncommented it either silently fails, or it does something unexpected to me.
babel: {
//build: {
options: {
sourceMap: true,
presets: ['es2015']
},
dist: {
files: [{
expand: true,
cwd: 'build/src/app',
src: ['**/*.js'],
dest: 'build/src/es5-app'
}]
}
//}
},
So, with //build: { commented out, the es5-app directory is created at build/src, but with //build: { uncommented, the directory is not created. In both instances grunt is run as grunt babel, and it returns Done, without errors.
Since grunt-babel is registered as a multi task,
distis actually the name of the target, withfilesbeing at the first level of the config. So when you run babel withoutbuild, it's actually runningbabel:dist(which you should see in the log).For it to work the way you want, you would need something like the following:
This would allow you to run either babel:dist or babel:build.
See http://gruntjs.com/creating-tasks for more information on multi tasks.