-
Notifications
You must be signed in to change notification settings - Fork 2
/
gulpfile.js
45 lines (38 loc) · 1.08 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
"use strict";
const projectName = 'money';
const gulp = require('gulp');
const jshint = require('gulp-jshint');
const uglify = require('gulp-uglify');
const rename = require('gulp-rename');
const concat = require('gulp-concat');
const notify = require('gulp-notify');
const del = require('del');
const karmaServer = require('karma').Server;
function scripts() {
return gulp.src('source/*.js')
.pipe(jshint('.jshintrc'))
.pipe(jshint.reporter('default'))
.pipe(concat(projectName + '.js'))
.pipe(gulp.dest('dist'))
.pipe(rename({suffix: '.min'}))
.pipe(uglify())
.pipe(gulp.dest('dist'))
.pipe(notify({ message: 'Scripts task complete' }));
}
function tests(done) {
new karmaServer({
configFile: __dirname + '/karma.conf.js'
}, done).start();
}
function clean() {
return del(['dist']);
}
function watch() {
gulp.watch('source/*.js', ['scripts']);
}
const build = gulp.series(clean, scripts);
exports.scripts = scripts;
exports.tests = tests;
exports.clean = clean;
exports.watch = watch;
exports.default = build;