hot content reload

This commit is contained in:
Jacky Zhao 2023-07-22 16:06:36 -07:00
parent b7966ff7fa
commit 8dd73704e6
6 changed files with 86 additions and 15 deletions

View file

@ -72,7 +72,7 @@ const BuildArgv = {
serve: {
boolean: true,
default: false,
describe: 'run a local server to preview your Quartz'
describe: 'run a local server to live-preview your Quartz'
},
port: {
number: true,
@ -255,6 +255,7 @@ See the [documentation](https://quartz.jzhao.xyz) for how to get started.
setup(build) {
build.onLoad({ filter: /\.inline\.(ts|js)$/ }, async (args) => {
let text = await promises.readFile(args.path, 'utf8')
// remove default exports that we manually inserted
text = text.replace('export default', '')
text = text.replace('export', '')