Charles
Charles

Reputation: 835

Ionic 2 Livereload

When developing with Ionic 2 how does one stay on the current page when making code changes? In Ionic 1 livereload would take you back to your current url - however in ionic 2 there are no urls.

Is there a setting that will make livereload keep me on the current page?

I'm open to enabling URLs as well if that's what it takes to not have to manually navigate back to my page on every code change. However I haven't been able to find how to do that in the v2 docs yet.

Upvotes: 6

Views: 1998

Answers (4)

abhay chaturvedi
abhay chaturvedi

Reputation: 11

Actually ionic.config.js has been deprecated . So i found a way may , go to this node_modules\@ionic\app-scripts\config . Change in file called watch.js

srcFiles: {
    paths: ['{{SRC}}/**/*.(ts|html|s(c|a)ss)'],
    options: { ignored: ['{{SRC}}/**/*.spec.ts', '{{SRC}}/**/*.e2e.ts', '**/*.DS_Store'] },
    callback: watch.buildUpdate
  },

Upvotes: 1

user1752532
user1752532

Reputation:

You could set the this.rootPage in your app.component.ts to the page you are working on. I often do this if i am working on say the foobar.ts page for a while ill change it to

this.rootPage = FooBar;

And then change it back to the default root page when i am done.

Upvotes: 2

Jose Luis Berrocal
Jose Luis Berrocal

Reputation: 1

No, there is no way to do what you are asking for, because ionic 2 is not using urls. Actually they are handling the pages as a variable on window, so when you or the live reload refresh the page it will go to the initial state. By the way actually there are no plans for implement the angular router, let's wait until the RC, maybe they would like to implement it

Upvotes: -1

Dipak
Dipak

Reputation: 6940

To stop live reloading in Ionic2 following changes I have done in the configurations file : ionic.config.js.

In ionic.config.js

watch: {
  sass: ['app/**/*.scss'],
  html: ['app/**/*.html'],
  livereload: [
    'www/build/**/*.html',
    'www/build/**/*.js',
    'www/build/**/*.css'
  ]
}

above section edited to :

watch: {
  sass: ['app/**/*.scss'],
  html: ['app/**/*.html'],
}

Then stopped ionic serve by q, and again started. Auto refreshing got stopped, we have to manually refresh to reflect the latest changes.

Upvotes: 3

Related Questions