-
Notifications
You must be signed in to change notification settings - Fork 4
/
gulpfile.js
69 lines (58 loc) · 1.33 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
const path = require('path')
const gulp = require('gulp')
const plumber = require('gulp-plumber')
const Bourbon = require('bourbon')
const autoprefixer = require('autoprefixer')
const mqpacker = require('css-mqpacker')
const postcss = require('gulp-postcss')
const sass = require('gulp-sass')
const { flatten } = require('lodash/fp')
const sassSettings = {
outputStyle: 'compact',
precision: 7,
linefeed: 'lf',
includePaths: flatten([
Bourbon.includePaths,
[path.resolve(__dirname, 'node_modules/foundation-sites')]
])
}
const paths = {
dest: {
assets: 'static',
css: 'src'
},
src: {
sass: ['_sass/index.scss']
},
watch: {
sass: '_sass/*.scss'
}
}
const styles = function styles() {
const plugins = [
autoprefixer({
cascade: false,
flexbox: 'no-2009'
}),
mqpacker()
]
const pipeline = gulp
.src(paths.src.sass)
.pipe(plumber())
.pipe(sass(sassSettings).on('error', sass.logError))
.pipe(postcss(plugins))
// Run Sass for the second time to prettify
.pipe(sass(sassSettings).on('error', sass.logError))
.pipe(gulp.dest(paths.dest.css))
return pipeline
}
const watch = function watch() {
gulp.watch(paths.watch.sass, styles)
}
const build = gulp.series(styles)
module.exports = {
build,
styles,
watch,
default: gulp.series(build, watch)
}