forked from saburab/angular-schema-form-nwp-file-upload
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
68 lines (53 loc) · 1.93 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
var gulp = require('gulp');
var addStream = require('add-stream');
var angularTemplatecache = require('gulp-angular-templatecache');
var concat = require('gulp-concat');
var connect = require('gulp-connect');
var del = require('del');
var header = require('gulp-header');
var sourcemaps = require('gulp-sourcemaps');
var uglify = require('gulp-uglify');
var bower = require('./bower.json');
var banner = ['/**',
' * <%= bower.name %> - <%= bower.description %>',
' * @version v<%= bower.version %>',
' * @link <%= bower.homepage %>',
' * @license <%= bower.license %>',
' */',
''].join('\n');
function prepareTemplates() {
return gulp.src('./src/*.html')
//.pipe(minify and preprocess the template html here)
.pipe(angularTemplatecache({
module: 'schemaForm',
root: 'directives/decorators/bootstrap/nwp-file/'
}));
}
gulp.task('build-app-dev', function() {
return gulp.src('./src/schema-form-file.js')
//.pipe(concat your app js files somehow)
.pipe(sourcemaps.init())
// append the template js onto one file
.pipe(addStream.obj(prepareTemplates()))
.pipe(concat('schema-form-file.js'))
.pipe(sourcemaps.write())
.pipe(header(banner, { bower : bower } ))
.pipe(gulp.dest('./dist'));
});
gulp.task('build-app-prod', function() {
return gulp.src('./src/schema-form-file.js')
//.pipe(concat your app js files somehow)
// append the template js onto one file
.pipe(addStream.obj(prepareTemplates()))
.pipe(concat('schema-form-file.min.js'))
.pipe(uglify())
.pipe(header(banner, { bower : bower } ))
.pipe(gulp.dest('./dist'));
});
gulp.task('clean', function () {
return del(['./dist'], {dot: true});
});
gulp.task('watch', function () {
gulp.watch('./src/**/*', ['default']);
});
gulp.task('default', ['build-app-dev', 'build-app-prod']);