UNPKG

550 BJavaScriptView Raw
1var gulp = require('gulp');
2var gulpTypescript = require('gulp-typescript');
3
4gulp.task('default', function () {
5
6 gulp.watch('./**/*.?(tsx|ts)', function (event) {
7 ts(event.path);
8 });
9
10 /**
11 * ts解析
12 * @param path 连接
13 */
14 function ts(pathArr) {
15 var tsconfig = require('./tsconfig.json').compilerOptions;
16 return gulp
17 .src(pathArr, {
18 base: './'
19 })
20 .pipe(gulpTypescript(tsconfig))
21 .pipe(gulp.dest('./'));
22 }
23});
24