-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
38 lines (32 loc) · 1.08 KB
/
gulpfile.js
File metadata and controls
38 lines (32 loc) · 1.08 KB
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
const gulp = require('gulp');
const ts = require('gulp-typescript');
const JSON_FILES = ['src/*.json', 'src/**/*.json'];
const del = require('del');
const uglify = require('gulp-uglify');
// pull in the project TypeScript config
const tsProject = ts.createProject('tsconfig.json');
gulp.task('transpile', () => {
const tsResult = tsProject
.src()
.pipe(tsProject())
.on('error', function(err) {
console.log(err.toString());
this.emit('end');
});
return tsResult.js.pipe(gulp.dest('dist'));
});
gulp.task('watch', () => {
gulp.watch('src/**/*.ts', gulp.series('transpile'));
gulp.watch('src/**/*.html', gulp.series('html'));
});
gulp.task('assets', function() {
return gulp.src(JSON_FILES).pipe(gulp.dest('dist'));
});
// Gulp task to copy HTML files to output directory
gulp.task('html', function() {
return gulp.src('src/**/*.html').pipe(gulp.dest('dist'));
});
gulp.task('clean', function(cb) {
return del('dist/**', { force: true });
});
gulp.task('default', gulp.series('clean', 'html', 'transpile', 'watch'));