-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGulpfile.js
75 lines (58 loc) · 1.56 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
70
71
72
73
74
75
/*
* requesty
* https://github.com/parroit/requesty
*
* Copyright (c) 2014
* Licensed under the MIT license.
*/
'use strict';
var gulp = require('gulp');
var loadPlugins = require('gulp-load-plugins');
var source = require('vinyl-source-stream');
var browserify = require('browserify');
var gutil = require('gulp-util');
var $ = loadPlugins({
lazy: true
});
var test = './test/**/*.js';
var lib = './lib/**/*.js';
gulp.task('test', function() {
return gulp.src([test])
.pipe($.mocha({
ui: 'bdd',
reporter: 'spec'
})).on('error', function(err){
gutil.log(err.message);
});
});
gulp.task('test-phantom',function () {
return gulp.src(['./dist/test.html'])
.pipe($.mochaPhantomjs());
});
gulp.task('build', function() {
return browserify('./lib/requesty.js')
.bundle({
insertGlobals: false
})
.pipe(source('requesty.min.js'))
.pipe($.streamify($.uglify()))
.pipe(gulp.dest('website/dist'));
});
gulp.task('build2', function() {
return gulp.src('./lib/requesty.js')
.pipe($.pureCjs())
// .pipe($.streamify($.uglify()))
.pipe(gulp.dest('website/dist'));
});
gulp.task('build-test', function() {
return browserify('./test/all_test.js')
.bundle({
insertGlobals: false
})
.pipe(source('requesty-test.js'))
.pipe(gulp.dest('website/dist'));
});
gulp.task('watch', function() {
gulp.watch([lib, test], ['test']);
});
gulp.task('default', ['test', 'watch']);