sailsjs 生成动态 views/ejs 文件
sailsjs generate dynamic views/ejs files
我动态地 generating/copying ejs 文件并将它们放在 views 文件夹中,它们在开发模式下工作正常,但在生产模式下它不会反映更改,直到我重新启动 sails。我怎样才能让它在生产模式下也能工作?
我正在使用简单的 fs create/update 文件操作来写入 ejs 文件
你必须使用像 forever、nodemon 或其他东西这样的观察者...
永远安装 运行:
sudo npm install -g forever
运行它:
forever -w start app.js
找到解决方案。以下帖子在这方面帮助了我:
https://github.com/balderdashy/sails/issues/3513
http://expressjs.com/en/api.html
原因是,express 是在生产模式下兑现视图,所以禁用它是有效的。
sails.hooks.http.app.disable('view cache');
console.log("view-cache-disabled: " + sails.hooks.http.app.disabled("view cache"));
我动态地 generating/copying ejs 文件并将它们放在 views 文件夹中,它们在开发模式下工作正常,但在生产模式下它不会反映更改,直到我重新启动 sails。我怎样才能让它在生产模式下也能工作?
我正在使用简单的 fs create/update 文件操作来写入 ejs 文件
你必须使用像 forever、nodemon 或其他东西这样的观察者...
永远安装 运行:
sudo npm install -g forever
运行它:
forever -w start app.js
找到解决方案。以下帖子在这方面帮助了我:
https://github.com/balderdashy/sails/issues/3513
http://expressjs.com/en/api.html
原因是,express 是在生产模式下兑现视图,所以禁用它是有效的。
sails.hooks.http.app.disable('view cache');
console.log("view-cache-disabled: " + sails.hooks.http.app.disabled("view cache"));