简体   繁体   English

自动在sails.js / node.js中重新加载客户端文件

[英]Auto reload client-side files in sails.js/node.js

How can I auto reload the client side files such as the .ejs and the javascript files? 如何自动重新加载客户端文件,例如.ejs和javascript文件?

I have tried using forever but it seems to only autoreload the models and controllers.I'm looking for a way to auto-reload the client side files. 我已经尝试过永远使用,但似乎只能自动重新加载模型和控制器。我正在寻找一种自动重新加载客户端文件的方法。

For now, that can not be done. 目前,这还不能完成。 Only models, controllers, views and services files are reloaded. 仅重新加载模型,控制器,视图和服务文件。 All other can be reloaded only manually. 其他所有文件只能手动重新加载。

https://www.npmjs.com/package/sails-hook-autoreload https://www.npmjs.com/package/sails-hook-autoreload

Anyway I do not see the problem. 无论如何,我看不到问题。 Only configs and static files are not updated. 仅配置和静态文件不会更新。 That is done by Grunt at server startup. 这是由Grunt在服务器启动时完成的。 And you do not need to do it often, so you can manually restart server. 而且您不需要经常这样做,因此可以手动重新启动服务器。

I managed to solved it. 我设法解决了。

auto reload doesn't work on production mode. 自动重新加载不适用于生产模式。 Only on development 只有发展

After lost some time trying do this with sails/grunt, i install the livereload browser plugin ( http://livereload.com/extensions/ ) for .html, js and css and the package ( https://www.npmjs.com/package/sails-hook-autoreload ) for the models and controllers. 在花了一些时间尝试用sails / grunt进行此操作之后,我为.html,js和CSS和程序包( https://www.npmjs.com )安装了livereload浏览器插件( http://livereload.com/extensions/ )。 / package / sails-hook-autoreload ),用于模型和控制器。

It has another way in the link follow: 在链接跟随中还有另一种方式:

Get livereload to work with Sails.js 获取livereload以使用Sails.js

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM