-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathgulpfile.js
54 lines (47 loc) · 1.05 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
const browserSync = require('browser-sync').create()
const gulp = require('gulp')
const gulpPostcss = require('gulp-postcss')
const gulpRename = require('gulp-rename')
const easingGradient = require('postcss-easing-gradients')
const paths = {
base: './',
styles: {
src: './css/*.pcss',
dest: './css',
},
html: {
src: './*.html',
},
}
function serve(done) {
browserSync.init({
server: { baseDir: paths.base },
open: false,
})
done()
}
function reload(done) {
browserSync.reload()
done()
}
function watch() {
gulp.watch(paths.styles.src, gulp.series(css, reload))
gulp.watch(paths.html.src).on('change', browserSync.reload)
}
function css() {
return gulp
.src(paths.styles.src)
.pipe(
gulpPostcss([
easingGradient({
// Default settings
precision: 0.1,
alphaDecimals: 5,
}),
])
)
.pipe(gulpRename({ extname: '.css' }))
.pipe(gulp.dest(paths.styles.dest))
}
gulp.task('default', gulp.series(css, serve, watch))
gulp.task('style', gulp.series(css))