-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
38 lines (36 loc) · 1.02 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
var gulp = require('gulp'),
gulpif = require('gulp-if'),
sourcemaps = require('gulp-sourcemaps'),
uglify = require('gulp-uglify'),
ts = require('gulp-typescript');
//typescript
gulp.task('default', ['build']);
gulp.task('build', ['b-es3', 'b-es5', 'b-es6']);
gulp.task('b-es3', function () {
typescript("es3");
});
gulp.task('b-es5', function () {
typescript("es5");
});
gulp.task('b-es6', function () {
typescript("es6");
});
function typescript(esVersion) {
var compress;
if (esVersion === 'es6') {
compress = "max";
} else {
compress = "min";
}
var tsProject = ts.createProject('tsconfig.json', {
outFile: "./dist/Input."+esVersion+"."+compress+".js",
target: esVersion
});
return tsProject.src()
.pipe(tsProject())
// .pipe(sourcemaps.init())
.pipe( gulpif(compress === "min", uglify()) )
// .pipe(sourcemaps.write())
.pipe(gulp.dest(''));
// .pipe(browserSync.stream());
}