-
Notifications
You must be signed in to change notification settings - Fork 132
/
gulpfile.js
39 lines (34 loc) · 1003 Bytes
/
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
var gulp = require('gulp');
var include = require('gulp-include');
var jshint = require('gulp-jshint');
var stylish = require('jshint-stylish');
var uglify = require('gulp-uglify');
var rename = require('gulp-rename');
var KarmaServer = require('karma').Server;
function hint() {
return gulp.src('./src/**/*.js')
.pipe(jshint())
.pipe(jshint.reporter('jshint-stylish'))
.pipe(jshint.reporter('fail'));
};
function scripts() {
return gulp.src('./src/Pizzicato.js')
.pipe(include())
.pipe(gulp.dest('./distr'))
.pipe(gulp.dest('./site'))
.pipe(rename('Pizzicato.min.js'))
.pipe(uglify())
.pipe(gulp.dest('./distr'));
};
function test(done) {
new KarmaServer({
configFile: __dirname + '/karma.conf.js',
singleRun: true
}, done).start();
};
function watch() {
gulp.watch(['./src/**/*.js'], gulp.series(hint, scripts));
};
gulp.task('build', gulp.series(hint, scripts))
gulp.task('test', gulp.series(hint, scripts, test))
gulp.task('watch', gulp.series(hint, scripts, watch))