This repository has been archived by the owner on Feb 13, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgulpfile.js
50 lines (42 loc) · 1.4 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
/* global require */
var gulp = require('gulp');
var connect = require('gulp-connect');
var uglify = require('gulp-uglify');
var concat = require('gulp-concat');
var rename = require('gulp-rename');
var templateCache = require('gulp-angular-templatecache');
var streamqueue = require('streamqueue');
var fs = require('fs');
gulp.task('connect', function _connect(done) {
connect.server({
root: ['demo', './'],
livereload: true,
});
done();
});
gulp.task('minify', function _minify() {
var files = JSON.parse(fs.readFileSync('sources.json', 'utf-8'));
var stream = streamqueue({
objectMode: true
},
gulp.src(files),
gulp.src(['src/templates/**/*.html']).pipe(templateCache({
module: 'schemaFormPanel',
root: 'src/templates/',
}))
)
.pipe(concat('angular-schema-form-panel.js'))
.pipe(gulp.dest('./dist'))
.pipe(uglify())
.pipe(rename('angular-schema-form-panel.min.js'))
.pipe(gulp.dest('./dist'));
return stream;
});
gulp.task('reload', gulp.series('minify', function _reload() {
return gulp.src('./dist/**/*.*').pipe(connect.reload());
}));
gulp.task('watch', function _watch(done) {
gulp.watch(['./src/**/*.*', './demo/**/*.*'], gulp.task('reload'));
done();
});
gulp.task('default', gulp.parallel('minify', 'connect', 'watch'));