-
Notifications
You must be signed in to change notification settings - Fork 12
/
gulpfile.js
41 lines (33 loc) · 1 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
'use strict';
const gulp = require('gulp');
const eslint = require('gulp-eslint');
const mocha = require('gulp-mocha');
const sass = require('gulp-sass');
const istanbul = require('gulp-istanbul');
var files = ['index.js', 'gulpfile.js', './lib/*.js', './test/*.spec.js',
'./public/js/*.js', './commands/*.js', '!node_modules/**'];
gulp.task('lint', () => {
return gulp.src(files)
.pipe(eslint())
.pipe(eslint.format());
});
gulp.task('sass', () => {
return gulp.src('public/scss/style.scss')
.pipe(sass())
.pipe(gulp.dest('public/css'));
});
gulp.task('pre-test', () => {
return gulp.src(['lib/*.js', 'commands/*.js'])
.pipe(istanbul())
.pipe(istanbul.hookRequire());
});
gulp.task('test', ['pre-test'], () => {
return gulp.src('test/*.spec.js')
.pipe(mocha())
.pipe(istanbul.writeReports());
});
gulp.task('watch', () => {
gulp.watch(files, ['lint', 'test']);
gulp.watch('./public/scss/**/*.scss', ['sass']);
});
gulp.task('default', ['watch', 'sass', 'lint', 'test']);