I would like to set up grunt sweet so that I can have it start watching my sweetjs-using files and compile them as they change.
However, I am new to making gruntfiles and there is simply not enough information in that link for me to know how to set it up. Searching for files that use grunt.loadNpmTasks('grunt-sweet');
I was able to find a file to use as a template but I cannot get it working.
This gruntfile
/*global module:false*/
module.exports = function(grunt) {
'use strict';
grunt.initConfig({
sweet: {
content_dir: 'src',
publish_dir: 'build',
},
watch: {
sweet: {
files: [
'src/**'
],
tasks: 'sweet'
}
}
});
grunt.loadNpmTasks('grunt-sweet');
// Project tasks
grunt.registerTask('default', 'sweet');
};
Gives me
W:\sweetjs-playground> grunt sweet:watch
Running "sweet:watch" (sweet) task
Fatal error: Object #<Object> has no method 'done'
W:\sweetjs-playground> grunt sweet -v
Initializing
Command-line options: --verbose
Reading "Gruntfile.js" Gruntfile...OK
Registering Gruntfile tasks.
Initializing config...OK
Registering "grunt-sweet" local Npm module tasks.
Reading W:\sweetjs-playground\node_modules\grunt-sweet\package.json...OK
Parsing W:\sweetjs-playground\node_modules\grunt-sweet\package.json...OK
Loading "sweet.js" tasks...OK
+ sweet
Loading "Gruntfile.js" tasks...OK
+ default
Running tasks: sweet
Running "sweet" task
Verifying property sweet exists in config...OK
Fatal error: Object #<Object> has no method 'done'
Which seems like a success until it's not. What am I doing wrong here?
All I want is for it to automatically compile files in src into build
I'm not an expert on this, but you can try out this snippet. I hope it can help some way.
If it wont work, maybe your
files
path is the problem. Try out adding an extensionsrc: ['src/**/*{.php,.html}'],