-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathgulpfile.js
More file actions
54 lines (44 loc) · 1.36 KB
/
gulpfile.js
File metadata and controls
54 lines (44 loc) · 1.36 KB
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
'use strict';
const gulp = require('gulp')
const sass = require('gulp-sass')(require('sass'));
const postcss = require('gulp-postcss')
const cssnext = require('postcss-preset-env')
const scsslint = require('gulp-scss-lint')
const cache = require('gulp-cached')
const plumber = require('gulp-plumber')
const notify = require('gulp-notify')
const paths = {
scss: 'scss/',
scssLint: 'scss/**/*.scss',
css: 'static/css'
}
const scssOptions = {
//outputStyle: 'compressed',
sourceMap: true,
sourceComments: false
}
gulp.task('scss', function() {
const processors = [cssnext()]
return gulp.src(paths.scss + '*.scss')
.pipe(plumber({ errorHandler: notify.onError('<%= error.message %>' )}))
.pipe(sass(scssOptions))
.pipe(postcss(processors))
.pipe(gulp.dest(paths.css))
.pipe(notify('SCSS task finished.'))
});
gulp.task('scss-lint', function() {
return gulp.src([paths.scssLint, '!scss/external/*.scss'])
.pipe(plumber({ errorHandler: notify.onError('<%= error.message %>' )}))
.pipe(cache('scsslint'))
.pipe(scsslint({
'reporterOutputFormat': 'Checkstyle',
'config': '.scss-lint.yml',
'maxBuffer': 307200,
'endless': true
}))
.pipe(scsslint.failReporter('E'))
});
gulp.task('scss:watch', function() {
gulp.watch(paths.scssLint, gulp.series('scss'))
});
gulp.task('default', gulp.series('scss:watch'));