-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathgulpfile.js
83 lines (71 loc) · 2.38 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
var gulp = require('gulp'),
concat = require('gulp-concat'),
uglify = require('gulp-uglify'),
rename = require('gulp-rename'),
header = require('gulp-header'),
removeCode = require('gulp-remove-code'),
del = require('del'),
stripDebug = require('gulp-strip-debug');
var banner = [
'/*'
,' * impexjs is a powerful web application engine to build '
,' * reactive webUI system'
,' *'
,' *'
,' * Copyright 2015-'+ new Date().getFullYear() +' MrSoya and other contributors'
,' * Released under the MIT license'
,' *'
,' * website: http://impexjs.org'
,' * last build: '+new Date().toLocaleDateString()
,' */'
].join('\n') + '\n';
var libs = [
'src/shellStart.js',
'src/core/basic.js',
'src/core/util.js',
'src/core/parser.js',
'src/core/compiler.js',
'src/observe/Change.js',
'src/observe/Monitor.js',
'src/observe/observer.js',
'src/vdom/vnode.js',
'src/vdom/builder.js',
'src/vdom/transform.js',
'src/vdom/comparer.js',
'src/component/EventEmitter.js',
'src/component/Component.js',
'src/component/Task.js',
'src/component/watchers.js',
'src/impex.js',
'src/directive/build-in.js',
'src/filter/build-in.js',
'src/shellEnd.js'
];
gulp.task('build-dev', ['clean'], function() {
return gulp.src(libs)
.pipe(concat('impex.dev.all.js'))
.pipe(header(banner))
.pipe(gulp.dest('build'))
.pipe(gulp.dest('examples/lib/impex'))
.pipe(rename({suffix: '.min'}))
.pipe(uglify())
.pipe(header(banner))
.pipe(gulp.dest('build'));
});
gulp.task('build-prod', ['clean'], function() {
return gulp.src(libs)
.pipe(concat('impex.prod.all.js'))
.pipe(header(banner))
.pipe(removeCode({ production: true }))
.pipe(stripDebug())
.pipe(gulp.dest('build'))
.pipe(gulp.dest('examples/lib/impex'))
.pipe(rename({suffix: '.min'}))
.pipe(uglify())
.pipe(header(banner))
.pipe(gulp.dest('build'));
});
gulp.task('clean', function(cb) {
del(['build'], cb)
});
gulp.task('default', ['build-dev','build-prod']);