Svelte in Asciidoc
Sometimes you want to add interactive material or custom visualisations to a site built with asciidoc. Luckily, it is possible to do so. An example can be found in my datavis technologies material here.
The following steps are based on this blog post:https://dtang.dev/2020-01-25-adding-svelte-3-to-a-jekyll-site
-
Step 1: Create a separate directory for the svelte-components, including
rollup.config.js
, etc. -
Step 2: Create a
svelte-components/src
directory with:-
the svelte component files
-
main.js
-
-
Step 3: For each component you want to use, add the following to
main.js
:
|
|
-
Step 4: Add the following in each
.adoc
file in which you want to include a svelte component:
|
|
-
Step 5: Where you want to include a svelte component, add
|
|
-
Step 6: To run, type
cd svelte-components ; rollup -c rollup.config.js ; cd .. ; make ; http-server
That’s it.