-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
41 lines (35 loc) · 958 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
41
const gulp = require('gulp');
const ts = require('gulp-typescript');
const JSON_FILES = ['src/*.json', 'src/**/*.json'];
const uglify = require('gulp-uglify');
const pump = require('pump');
const rename = require('gulp-rename');
const merge = require('merge2');
// pull in the project TypeScript config
const tsProject = ts.createProject('tsconfig.json');
gulp.task('scripts', () => {
const tsResult = tsProject.src()
.pipe(tsProject());
return merge([
tsResult.js.pipe(gulp.dest('lib')),
tsResult.dts.pipe(gulp.dest('lib'))
]);
});
gulp.task('watch', ['scripts'], () => {
gulp.watch('src/**/*.ts', ['scripts']);
});
gulp.task('assets', function () {
return gulp.src(JSON_FILES)
.pipe(gulp.dest('lib'));
});
gulp.task('compress', function (cb) {
pump([
gulp.src('lib/**/*.js'),
uglify(),
rename({suffix: '.min'}),
gulp.dest('dist')
],
cb
);
});
gulp.task('default', ['watch', 'assets', 'compress']);