-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
35 lines (32 loc) · 880 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
/*
var module = require('module');
gulp.task -define tasks
gulp.src - points to files or folders
gulp.dest - where to place the compiled files
gulp.watch - watch file folders
*/
var gulp = require('gulp');
var sass = require('gulp-sass');
var browserSync = require('browser-sync').create();
var reload = browserSync.reload;
// Initialize settings browsersync
gulp.task('browser-sync', function(){
browserSync.init({
server:{
baseDir: "./dist"
},
})
})
// Sass → Css pipeline
gulp.task('sass',function(){
gulp.src('src/sass/**/*.scss')
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest('dist/css'))
.pipe(browserSync.stream());
});
// Watch changes
gulp.task('watch', ['browser-sync', 'sass'], function(){
gulp.watch('src/sass/**/*.scss', ['sass']);
})
// Sync changes to browser
gulp.task('default', ['browser-sync', 'sass','watch']);