-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgulpfile.babel.js
93 lines (75 loc) · 1.84 KB
/
gulpfile.babel.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
/**
* @file
* Runs our tests.
*/
'use strict';
import gulp from 'gulp';
import del from 'del';
import sass from 'gulp-sass';
import sassLint from 'gulp-sass-lint';
let config = {};
config.sass = {
src: 'kss-assets',
dest: 'kss-assets'
}
config.sassOptions = {
includePaths: [
config.sass.src,
],
outputStyle: 'expanded'
}
/**
* Clean CSS files.
*/
const clean = function() {
return del([config.sass.dest + '/**/*.css'], { force: true });
};
clean.description = 'Clean CSS files.';
gulp.task('clean', clean);
/**
* Output CSS.
*/
const styles = function() {
return gulp.src([config.sass.src + '/**/*.scss'])
.pipe(sass(config.sassOptions).on('error', sass.logError))
.pipe(gulp.dest(config.sass.dest));
};
styles.description = 'Outputs CSS.';
gulp.task('styles', styles);
/**
* Lint everything.
*/
const lint = function() {
return gulp.src([config.sass.src + '/**/*.scss', 'stylesheets/**/*.scss'])
.pipe(sassLint())
.pipe(sassLint.format());
};
lint.description = 'Lint everything.';
gulp.task('lint', lint);
/**
* Lint everything (and fail).
*/
const lintWithFail = function() {
return gulp.src([config.sass.src + '/**/*.scss', 'stylesheets/**/*.scss'])
.pipe(sassLint())
.pipe(sassLint.format())
.pipe(sassLint.failOnError());
};
lint.description = 'Lint everything (and fail).';
gulp.task('lint:with-fail', lintWithFail);
/**
* Build.
*/
const build = gulp.series('clean', 'styles');
build.description = 'Build the test files.';
gulp.task('build', build);
/**
* Watch, compile, lint and test.
*/
const watch = function(e) {
gulp.watch([config.sass.src + '/**/*.scss', 'stylesheets/**/*.scss'], gulp.series('build', 'lint'));
};
watch.description = 'Watch, build, lint.';
gulp.task('watch', watch);
// Set the default task to build & watch.
gulp.task('default', gulp.series('build', 'lint', 'watch'));