-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathgulpfile.js
53 lines (40 loc) · 1.2 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
var gulp = require('gulp')
, concat = require("gulp-concat")
, browserify = require('browserify')
, uglify = require('gulp-uglify')
, source = require('vinyl-source-stream')
, mocha = require('gulp-mocha')
, mochaPhantomJS = require('gulp-mocha-phantomjs')
, deploy = require('gulp-gh-pages');
gulp.task('browserify', function() {
return browserify('./index-browserify.js')
.bundle()
.pipe(source('drag-mock.js'))
.pipe(gulp.dest('dist/'));
});
gulp.task('uglify', ['browserify'], function() {
return gulp.src('dist/drag-mock.js')
.pipe(uglify())
.pipe(concat('drag-mock.min.js'))
.pipe(gulp.dest('dist/'));
});
gulp.task('test-browser', function() {
return gulp
.src('test/browser/runner.html')
.pipe(mochaPhantomJS({
webSecurityEnabled: false,
outputEncoding: 'utf8'
}));
});
gulp.task('test-node', function() {
return gulp
.src('test/node/spec/*.spec.js', { read: false })
.pipe(mocha());
});
gulp.task('test', ['test-browser', 'test-node']);
gulp.task('deploy', ['dist', 'test'], function() {
return gulp.src('./dist/**/*')
.pipe(deploy());
});
gulp.task('dist', ['browserify', 'uglify']);
gulp.task('default', ['dist', 'test']);