3

Is there a way to watch for code changes, and automatically reload the browser using only npm and package.json (I'm trying to avoid using Gulp et al. ) If so, can you suggest some scripts to accomplish this?

Hexatonic
  • 2,251
  • 2
  • 21
  • 26

1 Answers1

0

I just had the same issue and ended up using the pipe operator, which runs tasks concurrently. For example:

cp -R css src/css && watchify src/js/main.js -o src/js/bundle.min.js | node bs.js

Which is essentially: copy the CSS, then run watchify and browser-sync concurrently.

From a quick skim of the link below, I think the issue is with this is will only work on Mac OS and Linux, not Windows. For that you can use concurrently.

More discussion of this here: How can I run multiple NPM scripts in parallel?

Community
  • 1
  • 1
Jon Higgins
  • 176
  • 1
  • 3