-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
35 lines (30 loc) · 886 Bytes
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
"use strict";
// Include gulp
var fs = require("fs");
var gulp = require("gulp");
var sourcemaps = require("gulp-sourcemaps")
var path = require("path");
var browserSync = require("browser-sync").create();
var sass = require('gulp-sass');
var reload = browserSync.reload;
gulp.task('watch',['sass'], function(){
browserSync.init({
server:'./'
});
gulp.watch("./scss/**/*.scss", ['sass']);
gulp.watch("./js/**/*.js").on('change', reload);
gulp.watch("./**/*.html").on('change', reload);
});
gulp.task('serve', ['watch']);
gulp.task('sass',function(){
return gulp.src('./scss/**/*.scss')
.pipe(sourcemaps.init())
.pipe(sass()).on('error', function logError(error) {
console.error(error);
})
.pipe(sourcemaps.write())
.pipe(gulp.dest('./css'))
.pipe(reload({stream:true}));
});
/* Default task */
gulp.task("default", ["serve"]);