forked from odra/ng-json-explorer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
40 lines (35 loc) · 999 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
36
37
38
39
40
var gulp = require('gulp');
var uglify = require('gulp-uglify');
var concat = require('gulp-concat');
var open = require('gulp-open');
var license = require('gulp-license');
function isArray (arr) {
return typeof path == 'object' && path.hasOwnProperty('length');
}
function genFile (path, filename, shouldUglify, dist) {
var fileList = [];
if (isArray(path)) {
fileList = path;
} else {
fileList.push(path);
}
var file = gulp.src(fileList);
if (shouldUglify) {
file
.pipe(concat(filename.replace('.js', '.min.js')))
.pipe(uglify())
.pipe(gulp.dest(dist));
}
file
.pipe(concat(filename))
.pipe(gulp.dest(dist));
}
gulp.task('build', function () {
genFile('./src/angular-json-explorer.js', 'angular-json-explorer.js', true, './dist');
genFile('./src/angular-json-explorer.css', 'angular-json-explorer.css', false, './dist');
});
gulp.task('run', function () {
gulp.src('./demo/demo.html')
.pipe(open('<%file.path%>'));
});
gulp.task('default', ['build', 'run']);