3

I am working in a project with sail.js everything is ok but each time I modified something I have to restart "sails lift". Is there not an option where with the server online I could work and see all the changes I did?

As info the problem is more with the js and styles, also I use foundation and when I compile with grunt, I always have to restart the server.

I use this option for raise the sails:

 Sails lift --dev --verbose
Jason Aller
  • 3,541
  • 28
  • 38
  • 38
Rubén Fanjul Estrada
  • 1,296
  • 19
  • 31
  • Are you saving your Javascript and CSS files under the `/assets` directory? That's the only folder that gets copied by Grunt. – sgress454 Mar 25 '14 at 15:17
  • Yes, there and under linker/ – Rubén Fanjul Estrada Mar 25 '14 at 15:32
  • When you save a `.js` or `.css` file, do you see any output in the console indicating that Grunt processed the file? Or any errors? – sgress454 Mar 25 '14 at 15:37
  • Could be for that verbose: Rendering view :: home/index (located @ /Users/em/php/swapit/views/home/index) verbose: Grunt :: Fatal error: EMFILE, readdir '/Users/em/php/swapit/assets/linker/js/' verbose: Grunt :: Fatal error: EMFILE, readdir '/Users/em/php/swapit/assets/linker/js/' Fatal error: EMFILE, readdir '/Users/em/php/swapit/assets/linker/js/' – Rubén Fanjul Estrada Mar 25 '14 at 15:53
  • But if I restart the server I have the "testfile.js" – Rubén Fanjul Estrada Mar 25 '14 at 15:55
  • 2
    EMFILE means you're hitting the open file limit. See http://stackoverflow.com/questions/34588/how-do-i-change-the-number-of-open-files-limit-in-linux/34645#34645 – sgress454 Mar 25 '14 at 16:21
  • @RubénFanjulEstrada Even I am facing this kind of cache issue. I got EMFILE issue in Grunt. Hopes somebody will answer this. – Dinesh May 07 '14 at 14:47
  • possible duplicate of [Auto reloading a Sails.js app on code changes?](http://stackoverflow.com/questions/18687818/auto-reloading-a-sails-js-app-on-code-changes) –  Dec 11 '14 at 05:31
  • I've marked this question as a duplicate. While `grunt watch` may watch for changes, it won't restart the server. You'll need to lrun nodemon or some such. Sails, however, runs LESS (why not stylus, I don't know) so you may be able to watch CSS changes and lift sails after compiling less to CSS. –  Dec 11 '14 at 05:35

2 Answers2

1

Actually in old versions of sails.js you don't. But starting v0.11.0+ you have an ability to install autoreload hook that will do exactly what you need.

npm install --save-dev sails-hook-autoreload

But there is one note: It wouldn't automatically apply changes into your config files. So if you will change something there, you will have to restart sails manually.

And here is a link to this hook: https://github.com/sgress454/sails-hook-autoreload

0

Why not use nodemon instead ?
look into this : https://nodemon.io/
It does the work for me .
just do a npm install --save nodemon and instead of sails lift you could use nodemon -w *x

*x = (whichever folder you want to watch)

for example nodemon -w api -w config will restart the app automatically if there is a change api or config folder

UchihaItachi
  • 2,602
  • 14
  • 21