import browserSync from 'browser-sync';
import config from '../config/config';
import gulp from 'gulp';
import paths from '../modules/paths';

const b = browserSync.create();

global.browserSync = b;

gulp.task('livereload', (callback) => {

  const cfg = config.nodeModules.browserSync;

  cfg.serveStatic = cfg.serveStatic.map(item => ({
    route: item.route,
    dir: paths.relocate(item.dir)
  }));
  b.init(cfg, callback);
});
