0

I'm developing an Angular 2 app using angular cli. I'm also using gulp as a task runner in the project. I want to use BrowserSync with gulp instead of the default ember live reload plugin that angular cli provides with. I have tried using proxy option in gulp browserSync to that of the default ng serve port ie: 4200. But then when gulp is running, I'm unable to run the project (ng serve). So can anyone please help me with this problem as I want to run browserSync with gulp. This might be a very n00b question as I'm new to gulp and angular, but help would be appreciated. Thanks.

Update: I was able to connect to BrowserSync using gulp but then the changes that I had made weren't getting updated either in the /dist folder or in the browser.

Gaurav Prabhu
  • 102
  • 1
  • 9

1 Answers1

3

If you're still using ng serve, then you should know that all the files are only compiled in-memory. So there are no file changes for BrowserSync to reload.

Instead, use ng build --watch, which will watch for file changes and automatically build to your /dist folder. Then use BrowserSync to serve from there.

Cobus Kruger
  • 8,338
  • 3
  • 61
  • 106