我在我的angularJS項目中使用grunt和grunt-angular-gettext。
無論何時更新源文件,我都會讓grunt運行grunt任務nggettext_extract
,並且每當更新「po」文件時我都會讓nggettext_compile
。
我想我可能只是添加任務名稱我的「grunt.task.run」任務列表中,這樣說:Grunt + angular gettext:如何提取和/或連續編譯?
...
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'
]);
});
...
但不幸的是這僅適用於第一個咕嚕運行,而不是事後... 我甚至可以接受我的項目中任何時候運行任何文件更改(我不確定如何指定Gruntfile.js中的依賴關係,我對它很新... :-()
如果它可以有任何幫助,這些是我的nggettext_任務配置(非常標準):
...
nggettext_extract: {
pot: {
files: {
'po/template.pot': [ 'app/**/*.html', 'app/scripts/**/*.js' ]
}
}
},
nggettext_compile: {
all: {
files: {
'app/scripts/translations.js': ['po/*.po']
}
}
},
...
請張貼'手錶:'你gruntfile的部分。這就是配置什麼時候運行的地方。 – 2014-10-13 18:16:35