public
Last active

example Gruntfile for grunt-sweet.js

  • Download Gist
Gruntfile.js
JavaScript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
 
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']);
};

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.