LHJ

I'm a FE developer.

browserSync reload

03 Sep 2020 » node_module

browserSync reload

browserSync reload 방법 중에 제일 좋은 방법인 것 같습니다.
제일 버그 없이 잘 작동했습니다.

const browserSync = require('browser-sync').create();

function browserSyncReload (done) {
  browserSync.reload();
  done();
}

function gulpWatch () {
  watch([
    `${gulpConfig.src}/img/**/*`,
    `!${gulpConfig.src}/img/*.png`,
    `!${gulpConfig.src}/img/*.svg`
  ], series(clean_img, parallel(spriteSvg, sprites), copy_image, sass, browserSyncReload));
  watch([
    `${gulpConfig.src}/scss/**/*`,
    `!${gulpConfig.src}/scss/vendor/*-mixins.scss`
  ], series(clean_css, sass, browserSyncReload));
  watch(`${gulpConfig.src}/json/**/*`, series(clean_json, copy_json, browserSyncReload));
  watch(`${gulpConfig.src}/html/**/*`, series(parallel(make_indexfile, series(clean_html, process_html)), browserSyncReload));
  watch('index.html', series(make_indexfile, browserSyncReload));
}