I've set up a Grunfile to monitor .js files in the src/ directory and trigger the babel task from https://github.com/babel/grunt-babel to generate ES5 files in the dist/ directory:
module.exports = function(grunt) {
require('load-grunt-tasks')(grunt);
grunt.initConfig({
babel: {
options: {
sourceMap: false
},
dist: {
files: [{
expand: true,
cwd: 'src/',
src: ['*.js'],
dest: 'dist/',
ext: '.js'
}]
}
},
watch: {
ej6: {
files: "src/*.js",
tasks: ['babel']
}
}
});
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.registerTask('default', ['babel', 'watch']);
};
My question is, can I modify the setup to watch only the specific file that has been modified in the src/ directory instead of regenerating all 'n' files?