Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
example Gruntfile for grunt-sweet.js
module.exports = function(grunt) {
grunt.initConfig({
sweetjs: {
options: {
modules: ['es6-macros'],
sourceMap: true,
nodeSourceMapSupport: true
},
src: {
files: [{
expand: true,
cwd: 'src/',
src: ['**/*.js'],
dest: 'build/'
}]
}
},
watch: {
options: {
nospawn: true
},
sweetjs: {
files: ['src/**/*.js'],
tasks: ['sweetjs:src']
}
}
});
grunt.event.on('watch', function(action, filepath, target) {
if(action == 'changed' && target == 'sweetjs') {
grunt.config.set('sweetjs.src.src', [filepath]);
grunt.config.set('sweetjs.src.dest', filepath.replace(/^src/, 'build'));
}
});
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-sweet.js');
grunt.registerTask('default', ['sweetjs']);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment