This repository has been archived by the owner on Mar 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathgulpfile.js
75 lines (63 loc) · 1.69 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
const gulp = require('gulp')
const P = require('gulp-load-plugins')()
const del = require('del')
const tsProject = P.typescript.createProject('tsconfig.json');
const tscFiles = 'src/**.ts'
const assetsFiles = 'src/assets/**/*.{png,svg,jpg,js}'
const pluginDefinition = 'plugin.json'
const readme = 'README.md'
const templateFiles = 'src/partials/*.pug'
const styleFiles = ['src/style/light.less', 'src/style/dark.less']
gulp.task('tsc', (done) => {
gulp
.src(tscFiles)
.pipe(tsProject())
.pipe(gulp.dest('dist/'))
.pipe(P.livereload());
done();
})
gulp.task('pug', (done) => {
gulp
.src(templateFiles)
.pipe(P.pug({}))
.pipe(gulp.dest('dist/template'))
.pipe(P.livereload());
done();
})
gulp.task('less', (done) => {
gulp
.src(styleFiles)
.pipe(P.less({}))
.pipe(gulp.dest('dist/style'))
.pipe(P.livereload());
done();
})
gulp.task('assets', (done) => {
gulp
.src(assetsFiles)
.pipe(gulp.dest('dist/assets'))
.pipe(P.livereload());
done();
})
gulp.task('plugin', (done) => {
gulp
.src([pluginDefinition, readme])
.pipe(gulp.dest('dist/'))
.pipe(P.livereload());
done();
})
gulp.task('clean', (done) => {
del(['dist/']);
done;
})
gulp.task('watch', (done) => {
P.livereload.listen()
gulp.watch(tscFiles, gulp.series('tsc'))
gulp.watch(assetsFiles, gulp.series('assets'))
gulp.watch([pluginDefinition, readme], gulp.series('plugin'))
gulp.watch(templateFiles, gulp.series('pug'))
gulp.watch('src/style/**.less', gulp.series('less'));
done();
})
gulp.task('build', gulp.series('assets', 'tsc', 'pug', 'less', 'plugin'))
gulp.task('default', gulp.series('build', 'watch'))