本文介绍了在代码更改时自动重新加载Sails.js应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

当前看来,对于sails.js应用程序中的任何代码更改,您都必须先手动停止sails服务器并再次运行sails lift,然后才能看到更改.

Currently is seems that for any code change in a sails.js app you have to manually stop the sails server and run sails lift again before you can see the changes.

我想知道在开发模式下运行时,是否有任何方法可以在检测到代码更改时自动重启sails服务器?

I was wondering if there is any way when running in development mode to automatically restart the sails server when it detects a code change?

推荐答案

您必须使用类似 nodemon 或其他...

You have to use a watcher like forever, nodemon, or something else...

  1. 通过运行以下命令永久安装 :

sudo npm install -g forever

运行它:

forever -w start app.js


为避免由于Sails写入.tmp文件夹而导致无限重启,您可以在项目目录中创建一个.foreverignore文件,并将此内容放入其中:


To avoid infinite restart because Sails writes into .tmp folder, you can create a .foreverignore file into your project directory and put this content inside:

**/.tmp/**
**/views/**
**/assets/**

在GitHub上查看问题:由于/.tmp而永远重启.

See the issue on GitHub:Forever restarting because of /.tmp.

这篇关于在代码更改时自动重新加载Sails.js应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 12:32