-
Notifications
You must be signed in to change notification settings - Fork 9
/
gulpfile.js
49 lines (39 loc) · 1.38 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
39
40
41
42
43
44
45
46
47
48
49
const gulp = require('gulp')
const ts = require('gulp-typescript')
const STATIC_FILES = ['src/*.json', 'src/**/*.json', 'src/**/*.md']
const tsProject = ts.createProject('tsconfig.json')
gulp.task('compile', () => {
const tsResult = tsProject.src()
.pipe(tsProject());
return tsResult.js.pipe(gulp.dest('dist'))
});
gulp.task('assets', function () {
return gulp.src(STATIC_FILES)
.pipe(gulp.dest('dist'));
});
gulp.task('partials', function () {
return gulp.src(['src/partials/*'])
.pipe(gulp.dest('dist/partials/'));
});
gulp.task('css', function () {
return gulp.src(['src/css/*'])
.pipe(gulp.dest('dist/css/'));
});
gulp.task('img', function () {
return gulp.src(['src/img/*'])
.pipe(gulp.dest('dist/img/'));
});
gulp.task('lib', function () {
return gulp.src(['src/lib/*'])
.pipe(gulp.dest('dist/lib/'));
});
gulp.task('watch', gulp.series('compile', () => {
gulp.watch('src/**/*.ts', gulp.series('compile'));
gulp.watch('src/**/*.json', gulp.series('assets'));
gulp.watch('src/**/*.md', gulp.series('assets'));
gulp.watch('src/partials/*', gulp.series('partials'));
gulp.watch('src/css/*', gulp.series('css'));
gulp.watch('src/img/*', gulp.series('img'));
gulp.watch('src/lib/**/*', gulp.series('lib'));
}));
gulp.task('default', gulp.series('watch', 'assets', 'partials', 'css', 'img', 'lib'));