Skip to content

Instantly share code, notes, and snippets.

@jlongster
Last active August 29, 2015 13:56
Show Gist options
  • Save jlongster/8838950 to your computer and use it in GitHub Desktop.
Save jlongster/8838950 to your computer and use it in GitHub Desktop.
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