-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
58 lines (52 loc) · 1.35 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
const gulp = require('gulp')
const sass = require('gulp-sass')(require('sass'))
const autoprefixer = require('gulp-autoprefixer')
const sourcemaps = require('gulp-sourcemaps')
const cleanCSS = require('gulp-clean-css')
const rename = require('gulp-rename')
/**
* Builds the dev version of skeleta
**/
function buildDev() {
return gulp
.src('./src/skeleta.scss')
.pipe(sourcemaps.init())
.pipe(sass().on('error', sass.logError))
.pipe(sourcemaps.write())
.pipe(autoprefixer({
cascade: false
}))
.pipe(gulp.dest('./dist'))
}
function buildDocs() {
return gulp
.src('./docs/docs.scss')
.pipe(sass().on('error', sass.logError))
.pipe(autoprefixer({
cascade: false
}))
.pipe(cleanCSS())
.pipe(rename({ suffix: '.min' }))
.pipe(gulp.dest('./dist'))
}
/**
* Builds the prod version of skeleta
**/
function buildProd() {
return gulp
.src('./src/skeleta.scss')
.pipe(sass().on('error', sass.logError))
.pipe(autoprefixer({
cascade: false
}))
.pipe(cleanCSS())
.pipe(rename({ suffix: '.min' }))
.pipe(gulp.dest('./dist'))
}
function watch() {
gulp.watch('./src/**/*.scss', gulp.parallel(buildProd, buildDev))
gulp.watch('./docs/**/*.scss', gulp.parallel(buildDocs))
}
exports.watch = watch
exports.build = gulp.parallel(buildDocs, buildProd, buildDev)
exports.default = exports.build