Gulp v4 Sass + Browser-sync

test

Quick gulpfile.js script to compile Sass and sync with browser for future reference.

More at: https://gulpjs.com/


const gulp = require("gulp");
const sass = require("gulp-sass");
const browserSync = require("browser-sync").create();
const concat = require("gulp-concat");

function style() {
  return gulp
    .src("./assets/scss/**/*.scss")
    .pipe(sass().on("error", sass.logError))
    .pipe(gulp.dest("./assets/css"))
    .pipe(browserSync.stream());
}

function watch() {
  browserSync.init({
    // server: {},
    proxy: "http://localhost:8888/gitema/",
    notify: true,
  });
  gulp.watch("./assets/scss/**/*.scss", style);
  gulp.watch("./*.php").on("change", browserSync.reload);
  gulp.watch("./assets/js/**/*.js").on("change", browserSync.reload);
}

exports.style = style;
exports.watch = watch;

You'll only receive email when Teo Oliver publishes a new post

More fromĀ Teo Oliver