-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
55 lines (48 loc) · 1.27 KB
/
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
const
gulp = require('gulp'),
plugins = require('gulp-load-plugins')(),
syncOpts = {
proxy : 'localhost/frameworkCSS',
files : [
'build/*',
'index.html'
],
watchEvents : ['add', 'change', 'unlink', 'addDir', 'unlinkDir'],
open : false,
notify : false,
ghostMode : false,
ui: {
port: 8001
}
}
;
console.log(plugins);
var browsersync = false;
gulp.task('css-prod', () => {
return gulp.src('./src/*.scss')
.pipe(plugins.sass({outputStyle: 'compressed'}))
.pipe(plugins.groupCssMediaQueries())
.pipe(plugins.autoprefixer({
browsers: ['last 2 versions', '> 2%']
}))
.pipe(gulp.dest('./build/'))
});
gulp.task('css-dev', () => {
return gulp.src('./src/*.scss')
.pipe(plugins.sourcemaps.init())
.pipe(plugins.sass())
.pipe(plugins.sourcemaps.write('.'))
.pipe(gulp.dest('./build/'))
});
gulp.task('browsersync', () => {
if (browsersync === false) {
browsersync = require('browser-sync').create();
browsersync.init(syncOpts);
}
});
gulp.task('watch:css', () => {
gulp.watch('./src/*.scss', gulp.series('css-dev'));
});
gulp.task('watch', gulp.parallel('watch:css'));
gulp.task('build', gulp.parallel('css-prod'));
gulp.task('default', gulp.parallel('browsersync','watch'));