-
Notifications
You must be signed in to change notification settings - Fork 18
/
gulpfile.js
51 lines (43 loc) · 1.24 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
import gulp from 'gulp';
import prefix from 'gulp-autoprefixer';
import sourcemaps from 'gulp-sourcemaps';
import gulpSass from 'gulp-sass';
import * as sassCompiler from 'sass';
const sass = gulpSass(sassCompiler);
/* ----------------------------------------- */
/* Compile Sass
/* ----------------------------------------- */
// Small error handler helper function.
function handleError(err) {
console.log(err.toString());
this.emit('end');
}
const SYSTEM_SCSS = ['styles/scss/**/*.scss'];
function compileScss() {
// Configure options for sass output. For example, 'expanded' or 'nested'
let options = {
outputStyle: 'expanded',
};
return gulp
.src(SYSTEM_SCSS)
.pipe(sourcemaps.init())
.pipe(sass(options).on('error', handleError))
.pipe(
prefix({
cascade: false,
}),
)
.pipe(sourcemaps.write())
.pipe(gulp.dest('./styles/css'));
}
/* ----------------------------------------- */
/* Watch Updates
/* ----------------------------------------- */
function watchUpdates() {
gulp.watch(SYSTEM_SCSS, build);
}
/* ----------------------------------------- */
/* Export Tasks
/* ----------------------------------------- */
export default gulp.series(compileScss, watchUpdates);
export const build = gulp.series(compileScss);