1
0
mirror of https://github.com/kognise/water.css.git synced 2025-08-08 06:06:57 +02:00

Added browser-sync

This commit is contained in:
Kyle Pollard
2019-04-07 17:47:23 -07:00
parent b19121261e
commit a4f4eb370a
3 changed files with 1032 additions and 14 deletions

View File

@@ -3,12 +3,16 @@ var gulp = require('gulp'),
postcss = require('gulp-postcss'),
autoprefixer = require("autoprefixer"),
cssnano = require("cssnano"),
sourcemaps = require("gulp-sourcemaps");
sourcemaps = require("gulp-sourcemaps"),
browserSync = require("browser-sync").create();
var paths = {
styles: {
src: "src/**/*.scss",
dest: "dist"
},
html: {
src: "index.html"
}
}
@@ -21,14 +25,28 @@ function style() {
.pipe(postcss([autoprefixer(), cssnano()]))
.pipe(sourcemaps.write())
.pipe(gulp.dest(paths.styles.dest))
.pipe(browserSync.stream())
);
}
exports.style = style;
function reload(){
browserSync.reload();
}
function watch() {
style();
gulp.watch(paths.styles.src, style)
browserSync.init({
server: {
baseDir: "./",
},
startPath: "index.html"
})
gulp.watch(paths.styles.src, style);
gulp.watch(paths.html.src, reload)
}
exports.watch = watch;