-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
executable file
·39 lines (32 loc) · 932 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
36
37
38
39
//Import
const gulp = require('gulp');
const sass = require('gulp-sass');
const sourceMaps = require('gulp-sourcemaps');
const autoprefixer = require('gulp-autoprefixer');
const browserSync = require('browser-sync');
//SCSS
function style() {
return gulp.src('./assets/scss/*.scss')
.pipe(sourceMaps.init())
.pipe(sass().on('error', sass.logError))
.pipe(autoprefixer())
.pipe(sourceMaps.write('./'))
.pipe(gulp.dest('./assets/css'))
.pipe(browserSync.stream());
}
//Serve and watch
function watch() {
browserSync.init({
server: {
baseDir: './',
},
startPath: './index.html',
ghostMode: false,
notify: false
});
gulp.watch('./assets/scss/*.scss', style);
gulp.watch('./*.html').on('change', browserSync.reload);
gulp.watch('./assets/js/*.js').on('change', browserSync.reload);
}
exports.style = style;
exports.watch = watch;