Angularjs 咕噜+;角度gettext:如何连续提取和/或编译?
我在angularJS项目中使用grunt和grunt angular gettext。Angularjs 咕噜+;角度gettext:如何连续提取和/或编译?,angularjs,gruntjs,grunt-angular-gettext,Angularjs,Gruntjs,Grunt Angular Gettext,我在angularJS项目中使用grunt和grunt angular gettext。 每当更新源文件时,我想让grunt运行grunt任务nggettext\u extract,每当更新“po”文件时,我想让grunt运行grunt任务nggettext\u compile。 我想我可以将任务名称添加到我的“grunt.task.run”任务列表中,方法如下: ... grunt.registerTask('serve', 'Compile then start a connect web
每当更新源文件时,我想让grunt运行grunt任务
nggettext\u extract
,每当更新“po”文件时,我想让grunt运行grunt任务nggettext\u compile
。我想我可以将任务名称添加到我的“grunt.task.run”任务列表中,方法如下:
...
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'
]);
});
...
我认为在你的Grunfile中类似的东西应该会起作用:
...
watch: {
po-changed: {
files: ["po/*.po"],
tasks: ["nggettext_compile"],
},
update-pot: {
files: ['app/**/*.html', 'app/scripts/**/*.js'],
tasks: ["nggettext_extract"],
},
},
...
请发布Grunfile的
watch:
部分。这是您配置何时运行的地方。谢谢!我自己已经解决了这个问题,但你的回答是正确的。我还添加了一个补充任务(tasks:['nggettext\u extract','po\u auto\u translate']
)到update pot
watch,运行我的脚本自动翻译缺失的条目,作为对人工翻译人员的帮助。。。
...
watch: {
po-changed: {
files: ["po/*.po"],
tasks: ["nggettext_compile"],
},
update-pot: {
files: ['app/**/*.html', 'app/scripts/**/*.js'],
tasks: ["nggettext_extract"],
},
},
...