Sails.js:在生产中运行grunt watch任务

时间:2014-10-17 22:23:11

标签: node.js gruntjs sails.js grunt-contrib-watch

我想在生产模式下运行完全相同的grunt watch任务,该任务在开发模式下运行。我认为这就像将监视任务添加到" prod.js" tasks/register/prod.js中的任务,但这样做可以在升空时挂起Sails。

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

1 个答案:

答案 0 :(得分:0)

  

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

我最近发现sails(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();
相关问题