Angular-cli: how can i disable the auto reload in angular 2?

Created on 23 Feb 2018  路  6Comments  路  Source: angular/angular-cli

Most helpful comment

ng serve --live-reload false

All 6 comments

ng serve --live-reload false

Closing as answered by @majo40 , thanks!

@filipesilva , Is it possible to stop auto reloading for some particular files.

Like I want to stop auto reloading when I made some changes in my css files?

If possible please let me know.

Same as @MrPardeep

You can add the querystring parameter hotreload=false when you load the page.

 https://example.com/products?hotreload=false

That way you can mess with the css, and even have a second window open that does autoreload (without this querystring). That way you can keep the first window open until you're sure you've applied all the css changes to the source.

The sourcecode (in vendor.js) that makes this possible is as follows:

var hotReload = true;
if (typeof window !== 'undefined') {
  var qs = window.location.search.toLowerCase();
  hotReload = qs.indexOf('hotreload=false') === -1;
}

Unfortunately it's a one time deal - you can't for instance set window.hotReload=false at a later time.

If there's a clever way to modify it after the page is open let me know!

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings