-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
59 lines (51 loc) · 1.49 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
// Include gulp
const gulp = require('gulp');
const gutil = require('gulp-util');
// Include gulp plugins
const eslint = require('gulp-eslint');
const nodemon = require('gulp-nodemon');
const sass = require('gulp-sass');
const browserSync = require('browser-sync');
const mocha = require('gulp-mocha');
const bower = require('gulp-bower');
const istanbul = require('gulp-istanbul');
// eslint task
gulp.task('lint', () => {
gulp.src(['**/*.js', '!node_modules/**'])
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError());
});
// nodemon task
gulp.task('nodemon_file', () => {
nodemon({
script: 'server.js',
ext: 'js html',
env: { NODE_ENV: 'development' } });
});
// sass task
gulp.task('sass', () => gulp.src('public/css/*.scss')
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest('public/css')));
gulp.task('sass:watch', () => {
gulp.watch('public/css/*.scss', ['sass']);
});
// watch task
gulp.task('watch', () => {
gulp.watch(['app/**/*.js', 'public/js/**/*.js'], ['lint'])
.on('change', browserSync.reload);
});
// checking tests with mocha task
gulp.task('test', () => gulp.src(['./test/**/*.js'], { read: false })
.pipe(mocha({ reporter: 'spec' }))
.pipe(istanbul.writeReports())
.pipe(istanbul.enforceThresholds({ thresholds: { global: 90 } }))
);
// run bower task
gulp.task('bower', () => {
bower();
});
// default task
gulp.task('default', ['lint', 'sass', 'bower', 'watch', 'nodemon_file'], () => {
gutil.log('Gulp is running!');
});