-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathgulpfile.js
35 lines (29 loc) · 822 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
var gulp = require('gulp');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var rename = require('gulp-rename');
var iife = require('gulp-iife');
var src = 'src/**/*.js';
gulp.task('build-dev', function buildDev() {
return gulp.src(src)
.pipe(concat('angular-middleware.js'))
.pipe(iife({
params: ['angular']
}))
.pipe(gulp.dest('./dist/'));
});
gulp.task('build-prod', ['build-dev'], function buildProd() {
return gulp.src('dist/angular-middleware.js')
.pipe(uglify())
.pipe(rename(function rename(path) {
path.basename += '.min';
}))
.pipe(gulp.dest('./dist/'));
});
gulp.task('watch', function watch() {
gulp.watch(src, ['build-dev']);
});
gulp.task('watch-prod', function watchProd() {
gulp.watch(src, ['build-prod']);
});
gulp.task('default', ['build-dev']);