I am using grunt and grunt-angular-gettext with my angularJS project.
I would like to let grunt run grunt task nggettext_extract
whenever a source file is updated, and nggettext_compile
whenever a 'po' file is updated.
I thought I could just add the tasks names to my 'grunt.task.run' tasks list, this way:
...
grunt.registerTask('serve', 'Compile then start a connect web server', function (target) {
grunt.task.run([
'nggettext_extract', <== added task, just executed on the first run
'nggettext_compile', <== added task, just executed on the first run
'clean:server',
'wiredep',
'concurrent:server',
'autoprefixer',
'connect:livereload',
'watch'
]);
});
...
but unfortunately this works only for the first grunt run, and not afterwards... It would even be acceptable for me to have both tasks run whenever any file changes in my project (I am not sure how to specify dependencies within Gruntfile.js, I'm quite new with it... :-().
If it can be of any help, these are my nggettext_ tasks configurations (quite standard):
...
nggettext_extract: {
pot: {
files: {
'po/template.pot': [ 'app/**/*.html', 'app/scripts/**/*.js' ]
}
}
},
nggettext_compile: {
all: {
files: {
'app/scripts/translations.js': ['po/*.po']
}
}
},
...
I think something similar to this in your gruntfile should work: