2019-03-27 11:40:36 +08:00
|
|
|
var gulp = require('gulp');
|
|
|
|
var ts = require('gulp-typescript');
|
|
|
|
|
|
|
|
var tsProject = ts.createProject('tsconfig.json');
|
2019-03-27 08:31:28 +08:00
|
|
|
|
|
|
|
let paths = {
|
|
|
|
pages: ["src/*.html"]
|
|
|
|
};
|
|
|
|
|
|
|
|
gulp.task("copy-html", ()=>{
|
|
|
|
return gulp.src(paths.pages)
|
|
|
|
.pipe(gulp.dest("dist"))
|
|
|
|
});
|
|
|
|
|
2019-03-27 11:40:36 +08:00
|
|
|
gulp.task('tsc', () => {
|
|
|
|
return gulp.src('src/*.ts')
|
|
|
|
.pipe(tsProject())
|
|
|
|
.pipe(gulp.dest('dist'));
|
|
|
|
});
|
|
|
|
|
2019-03-27 11:46:43 +08:00
|
|
|
// 这里 watch 里必须使用 gulp.series
|
2019-03-27 11:40:36 +08:00
|
|
|
gulp.task('watch', () => {
|
2019-03-27 16:51:18 +08:00
|
|
|
gulp.watch('src/*.ts', gulp.series('tsc'));
|
2019-03-27 11:40:36 +08:00
|
|
|
});
|
2019-03-27 08:31:28 +08:00
|
|
|
|
2019-03-27 11:46:43 +08:00
|
|
|
|
|
|
|
// 这里必须要有一个 default 任务
|
|
|
|
gulp.task('default', gulp.series('copy-html', 'tsc', 'watch'));
|