-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
60 lines (54 loc) · 1.4 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
const gulp = require('gulp');
const nodemon = require('gulp-nodemon');
const plumber = require('gulp-plumber');
const livereload = require('gulp-livereload');
const sass = require('gulp-sass');
const ava = require('gulp-ava');
const cleanCSS = require('gulp-clean-css');
gulp.task('sass', () => {
return gulp.src('./assets/scss/*.scss')
.pipe(plumber())
.pipe(sass())
.pipe(cleanCSS({
compatibility: 'ie8'
}))
.pipe(gulp.dest('./public/css'))
.pipe(livereload());
});
gulp.task('watch', () => {
livereload.listen();
gulp.watch(['./assets/scss/**/*.scss'], ['sass']);
});
gulp.task('develop', ['sass'], () => {
livereload.listen();
nodemon({
script: 'app/start.js',
ext: 'js vue scss',
stdout: true
}).on('readable', () => {
this.stdout.on('data', (chunk) => {
if (/^Express server listening on port/.test(chunk)) {
livereload.changed(__dirname);
}
});
this.stdout.pipe(process.stdout);
this.stderr.pipe(process.stderr);
}).once('quit', function () {
process.exit();
});
});
gulp.task('test', function () {
return gulp.src(['test/**/*.js'], {
read: false
})
.pipe(ava({verbose: true}));
});
gulp.task('default', [
'sass',
'test',
'develop',
'watch'
]);
gulp.task('build', [
'sass'
]);