-
Notifications
You must be signed in to change notification settings - Fork 8
/
gulpfile.js
31 lines (28 loc) · 870 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
'use strict';
var browserify = require('gulp-browserify');
var spawn = require('child_process').spawn;
var gulp = require('gulp');
var rename = require('gulp-rename');
var uglifyjs = require('gulp-uglifyjs');
var watch = require('gulp-watch');
gulp.task('default', function() {
gulp.src('index.js')
.pipe(browserify({ standalone: 'RestModel' }))
.pipe(rename('rest-model.js'))
.pipe(gulp.dest('dist'))
.pipe(uglifyjs())
.pipe(rename('rest-model.min.js'))
.pipe(gulp.dest('dist'));
});
gulp.task('watch', function() {
watch({ glob: [
'lib/**/*.js',
'index.js',
'index-v2.js',
'test/**/*.js'
] }, function() {
var test = spawn('npm', ['test']);
test.stdout.on('data', process.stdout.write.bind(process.stdout));
test.stderr.on('data', process.stderr.write.bind(process.stderr));
});
});