Search code examples
javascriptnode.jsnpmbrowser-syncharp

Harp and browser-sync invoked by package.json with npm


I'd like to facilitate a way to start a harp.js server and run a browser-sync process at the same time. It's working like a charm on Linux. This is the content of my package.json

{
  "scripts": {
    "dev": "bash ./serve.sh"
  }
}

And this is the serve.sh

#!/bin/bash
harp server &
browser-sync start --proxy 'localhost:9000' --files '*.jade, *.less'

When doing this on windows, I am supposed to do a bat file I presume, but isn't there a way to translate harp server & browser-sync etc etc to a corresponding command on windows?


Solution

  • for a package.json file, we would do something like this instead.

    {
      "scripts": {
        "dev": "harp server & browser-sync start --proxy 'localhost:9000' --files '*.jade, *.less'"
      }
    }
    

    give that a spin.