Ionic-cli: ionic serve does not automatically reload the browser

Created on 8 Aug 2016  路  14Comments  路  Source: ionic-team/ionic-cli

Hello, I am having a really weird issue.

I have latest ionic2 beta cli installed and working on Ionic v1 project, when I save a file i can see that ionic serve's command output logs out HTML changes: www/templates/login.html however SASS task is not executed and browser window is not reloaded. I have reinstalled Node and ionic to no luck...

Any help appreciated.

Cordova CLI: 6.3.0
Ionic Framework Version: 1.3.1
Ionic CLI Version: 2.0.0-beta.36
Ionic App Lib Version: 2.0.0-beta.19
ios-deploy version: 1.8.6 
ios-sim version: 5.0.8 
OS: Mac OS X El Capitan
Node Version: v6.3.1
Xcode version: Xcode 7.3 Build version 7D175 

Most helpful comment

I have a fix for you in the meantime (doesn't fix ionic setup sass, just sass running).

I just made a new task named 'serve:before', which will run first anytime ionic serve is run. Then have a watch task run sass for you anytime you make changes.

gulp.task('serve:before', [ "sass", "watch"], function() {
});

All 14 comments

Same issue here. I think that the issue with the SASS task has also to do with the issue that the command ionic setup sass is not working.

As far as I know they work on it.

@NeckbreakerPascal which existing issue are you talking about? can you mention it here?

I have a fix for you in the meantime (doesn't fix ionic setup sass, just sass running).

I just made a new task named 'serve:before', which will run first anytime ionic serve is run. Then have a watch task run sass for you anytime you make changes.

gulp.task('serve:before', [ "sass", "watch"], function() {
});

@okonon I mean issue #1245

@roblouie where did you add the code? Sorry, always just using ionic serve, so I did not really work with gulp before.

@NeckbreakerPascal I had exactly the same issue as you and fix from @roblouie has helped me now. Just add this code to gulpfile.js, after watch task, like this:

gulp.task('watch', function() {
  gulp.watch(paths.sass, ['sass']);
});

gulp.task('serve:before', [ "sass", "watch"], function() {
});

Hope that helps.

@roblouie solution works

Tried solution above but browser does not automatically reload on file changes still...

This works, thanks! Is there a way to run the new task when I do:
ionic emulate ios -lsc
???

@jbeuckm You can do:
gulp.task('emulate:before', [ "sass", "watch"], function() {});

This issue is fixed in 2bd7aeea83fe86eafe69e5f83e1ac766c58bbb39 .
Just updated ionic cli to 2.0.0-beta.37 and browser reloads correctly. Thanks @jthoms1

Not working for me.

Gulp version: CLI version 3.9.1
Gulp local: Local version 3.9.1
Ionic Framework Version: 1.3.1
Ionic CLI Version: 2.0.0-beta.37
Ionic App Lib Version: 2.0.0-beta.20
OS: Windows 7 SP1
Node Version: v4.4.4

I solved this problem by removing the folder node_modules/ and file package-lock.json, then at terminal run:
npm install --save

worked for me when i save with sublime instead of vscode

Was this page helpful?
0 / 5 - 0 ratings