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

Node.js Sails.js:在生产中运行grunt watch任务,node.js,gruntjs,sails.js,grunt-contrib-watch,Node.js,Gruntjs,Sails.js,Grunt Contrib Watch,我想在生产模式下运行与在开发模式下运行完全相同的grunt watch任务。我认为这就像在tasks/register/prod.js中将watch任务添加到prod.js任务中一样简单,但这样做会让事情一帆风顺 如何在生产中运行watch任务 如何在生产中运行watch任务 我最近发现,sailsv.0.11.0在启动前限制了生产模式下的grunt执行。要解决此问题,您需要更改/node_modules/sails/lib/hooks/grunt/index.js中的几行代码 具体来说,请对以

我想在生产模式下运行与在开发模式下运行完全相同的grunt watch任务。我认为这就像在tasks/register/prod.js中将watch任务添加到prod.js任务中一样简单,但这样做会让事情一帆风顺

如何在生产中运行watch任务

如何在生产中运行watch任务

我最近发现,sailsv.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();

你想这么做有什么特别的原因吗?从某种意义上说,我的应用程序允许用户将新页面上传到应用程序中,因此我需要Grunt在他们移动到资产中时观察并重新编译资产,否则,该应用程序将需要重新启动以反映新的更改。您找到解决方案了吗?是否有一种方法不涉及编辑节点_模块中的文件。我从git拉到服务器并运行npm安装,git不监视节点_模块。除此之外的任何方式都将不胜感激