forked from sathyapulse/angular-recorder
-
Notifications
You must be signed in to change notification settings - Fork 42
/
gulpfile.js
48 lines (36 loc) · 1.26 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
var gulp = require('gulp');
var footer = require('gulp-footer'),
header = require('gulp-header'),
ngModuleSort = require('gulp-ng-module-sort'),
concat = require('gulp-concat'),
uglify = require('gulp-uglify'),
replace = require('gulp-replace'),
rename = require('gulp-rename')
;
var scriptsGlob = 'src/**/*.js', outfile = 'angular-audio-recorder';
gulp.task('angularScripts', function () {
return gulp.src('src/angular/**/*.js')
.pipe(ngModuleSort())
.pipe(replace(/\s*'use strict';?\s*/, ''))
.pipe(concat(outfile + '.js')) // do things that require all files
.pipe(header('(function() {\n \'use strict\';\n'))
.pipe(footer('})();'))
.pipe(gulp.dest('.tmp/'));
});
gulp.task('scripts', ['angularScripts'], function () {
return gulp.src(['.tmp/' + outfile + '.js', 'src/*.js', '!src/angular/**/*.js'])
.pipe(concat(outfile + '.js'))
.pipe(gulp.dest('dist/'));
});
gulp.task('minify', ['scripts'], function () {
return gulp.src(['dist/' + outfile + '.js'])
.pipe(uglify({
outSourceMap: 'dist/' + outfile + ".js.map",
mangle: true
}))
.pipe(rename({extname: '.min.js'}))
.pipe(gulp.dest('dist'));
});
gulp.task('build', ['scripts', 'minify']);
//@TODO add tests
gulp.task('default', ['build']);