LoginSignup
2
2

More than 5 years have passed since last update.

Vagrant + docker 環境で proxy しつつ gulp + browser-sync で自動リロードする

Posted at

Qiita 初投稿です。

なにがあったのか

ローカルで gulp + browser-sync するのは慣れていたので、Vagrant + docker でも問題ないでしょ~と思ったら自動リロードが動かなかった。

解決

バーチャルマシン上では普通にやると gulp のファイル監視がうまくいかないらしい。
なので gulpfile.js の browserSync のところに usePolling: true を書いてあげないといけない。

browserSync.init({
    proxy: "接続先",
    files: [
      "監視したいファイル"
    ],
    watchOptions: {
      usePolling: true,
      interval: 100
    },
    reloadOnRestart: true,
    open: false
});

polling の処理が負荷としてどうなのかは気になるけど、とりあえず動いたのでめでたしめでたし。

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2