Sails.js:在生产中运行Grunt Watch任务

问题描述 投票:0回答:1

我想在生产模式下运行与开发模式下完全相同的监视任务。 我认为这就像将watch任务添加到task tasks/register/prod.js的“ prod.js”任务一样简单,但是这样做tasks/register/prod.js Sails挂起。

如何在生产中运行监视任务?

node.js gruntjs sails.js grunt-contrib-watch
1个回答
0
投票

如何在生产中运行监视任务?

我最近发现,帆(v.0.11.0)在启动之前会限制生产模式下的grunt执行。 要解决此问题,您需要在/node_modules/sails/lib/hooks/grunt/index.js中更改几行

具体来说,注释以下行:

// Fire finish after grunt is done in production
/*if(sails.config.environment === 'production'){
  cb_afterTaskStarted();
}*/

评论并添加:

// Go ahead and get out of here, since Grunt might sit there backgrounded
/*if(sails.config.environment !== 'production'){
 cb_afterTaskStarted();
}*/
cb_afterTaskStarted();
© www.soinside.com 2019 - 2024. All rights reserved.