gulp refactor
This commit is contained in:
parent
522dbb1e13
commit
f41c851108
|
@ -77,17 +77,9 @@ gulp.task('cleanall', gulp.parallel('clean', cb =>
|
||||||
rimraf('./node_modules', cb)
|
rimraf('./node_modules', cb)
|
||||||
));
|
));
|
||||||
|
|
||||||
gulp.task('copy:docs', () =>
|
|
||||||
gulp.src([
|
|
||||||
'./src/docs/**/*',
|
|
||||||
])
|
|
||||||
.pipe(gulp.dest('./built/assets/docs/'))
|
|
||||||
);
|
|
||||||
|
|
||||||
gulp.task('build', gulp.parallel(
|
gulp.task('build', gulp.parallel(
|
||||||
'build:ts',
|
'build:ts',
|
||||||
'build:copy',
|
'build:copy',
|
||||||
'copy:docs',
|
|
||||||
));
|
));
|
||||||
|
|
||||||
gulp.task('default', gulp.task('build'));
|
gulp.task('default', gulp.task('build'));
|
||||||
|
|
|
@ -60,7 +60,7 @@ export default defineComponent({
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
fetchDoc() {
|
fetchDoc() {
|
||||||
fetch(`${url}/assets/docs/${lang}/${this.doc}.md`).then(res => res.text()).then(md => {
|
fetch(`${url}/doc-assets/${lang}/${this.doc}.md`).then(res => res.text()).then(md => {
|
||||||
this.parse(md);
|
this.parse(md);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
@ -29,6 +29,7 @@ const markdown = MarkdownIt({
|
||||||
});
|
});
|
||||||
|
|
||||||
const staticAssets = `${__dirname}/../../../assets/`;
|
const staticAssets = `${__dirname}/../../../assets/`;
|
||||||
|
const docAssets = `${__dirname}/../../../src/docs/`;
|
||||||
const assets = `${__dirname}/../../assets/`;
|
const assets = `${__dirname}/../../assets/`;
|
||||||
|
|
||||||
// Init app
|
// Init app
|
||||||
|
@ -65,6 +66,13 @@ router.get('/static-assets/(.*)', async ctx => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
router.get('/doc-assets/(.*)', async ctx => {
|
||||||
|
await send(ctx as any, ctx.path.replace('/doc-assets/', ''), {
|
||||||
|
root: docAssets,
|
||||||
|
maxage: ms('7 days'),
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
router.get('/assets/(.*)', async ctx => {
|
router.get('/assets/(.*)', async ctx => {
|
||||||
await send(ctx as any, ctx.path.replace('/assets/', ''), {
|
await send(ctx as any, ctx.path.replace('/assets/', ''), {
|
||||||
root: assets,
|
root: assets,
|
||||||
|
|
Loading…
Reference in New Issue