Sapper (SSR Svelte Framework) with being able to export as static website
Markdown to write tips
Programmatically compile markdowns to a JSON file consumed by the website
How it works
This setup has a single static index page routes/index.svelte. Each .svelte file is considered a page that should be accompanied by a .json.js file responsible to export a get controller for data fetching. this data will be passed as props to the rendered page by Sapper.
Sapper will also generate a .json file based on the data that Get controller returns to be able to prefetch the data of any page in static export.
yarn export is the command we need to build our website. before running that, we'd need yarn compile-tips to run and prepare data/_tips.json by compiling markdown files.
Fixes: https://github.com/farskid/xstate.tips/issues/2
The tech
How it works
This setup has a single static index page
routes/index.svelte
. Each.svelte
file is considered a page that should be accompanied by a.json.js
file responsible to export a get controller for data fetching. this data will be passed as props to the rendered page by Sapper.Sapper will also generate a
.json
file based on the data that Get controller returns to be able to prefetch the data of any page in static export.yarn export
is the command we need to build our website. before running that, we'd needyarn compile-tips
to run and preparedata/_tips.json
by compiling markdown files.Quoting Sapper docs: