PJCHENder
7/31/2017 - 2:31 AM

Gulp BrowserSync

Gulp BrowserSync

{
  "name": "pjchender-gulp-template",
  "version": "0.0.6",
  "description": "",
  "main": "index.js",
  "scripts": {
    "start": "gulp",
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "browser-sync": "^2.18.8",
    "gulp": "^3.9.1"
  }
}
const gulp = require('gulp')
const browserSync = require('browser-sync').create()

// Static Server + watching scss/html files
gulp.task('serve', function () {
  browserSync.init({
    proxy: 'http://localhost:3000/'
  })
  gulp.watch('./../shopping-mall/app/**/*.{css,js,erb}', ['browser-reload'])
})

gulp.task('browser-reload', function (done) {
  browserSync.reload()
  done()
})

gulp.task('default', ['serve'])
tags: gulp, browsersync, browser reload, autoreload

This is a simple web server for auto browsersync.