forked from bumbu/svg-pan-zoom
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
70 lines (63 loc) · 1.32 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
61
62
63
64
65
66
67
68
69
/**
* Modules
*/
var gulp = require('gulp')
, watch = require('gulp-watch')
, uglify = require('gulp-uglify')
, browserify = require('browserify')
, source = require('vinyl-source-stream')
, streamify = require('gulp-streamify')
, rename = require('gulp-rename')
, qunit = require('gulp-qunit')
, jshint = require('gulp-jshint')
, jscs = require('gulp-jscs')
;
/**
* Build script
*/
gulp.task('browserify', function() {
return browserify({entries:'./src/stand-alone.js'})
.bundle()
.on('error', function (err) {
console.log(err.toString())
this.emit("end")
})
.pipe(source('svg-pan-zoom.js'))
.pipe(gulp.dest('./dist/'))
.pipe(streamify(rename('svg-pan-zoom.min.js')))
.pipe(streamify(uglify()))
.pipe(gulp.dest('./dist/'))
});
/**
* Watch script
*/
gulp.task('watch', function () {
gulp.watch('./src/**/*.js', ['browserify']);
});
/**
* Test task
*/
gulp.task('test', function () {
gulp.src('./tests/index.html')
.pipe(qunit())
});
/**
* Check
*/
gulp.task('check', function() {
gulp.src('./src/*')
.pipe(jshint())
.pipe(jshint.reporter('default'))
.pipe(jscs())
})
/**
* Build
*/
gulp.task('build', ['test', 'check', 'browserify'])
/**
* Default task
*/
gulp.task('default', [
'browserify',
'watch'
]);