You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+14-9Lines changed: 14 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,12 @@
1
1
# sverto
2
-
Add Svelte visualisations to your Quarto documents
3
2
4
-
## 🛍 Prerequisites
3
+
**Sverto** is an extension for [Quarto](https://quarto.org) that lets you seamlessly write and include [Svelte](https://svelte.dev) components, like charts and other visuals, in your Quarto website.
4
+
5
+
Your Svelte components can seamlessly react to your ObservableJS code, making it quick and easy to build visuals that animate in response to [user inputs](https://observablehq.com/@observablehq/inputs?collection=@observablehq/inputs) or other changing data in your document.
6
+
7
+
## 📋 Prerequisites
8
+
9
+
You'll need to install two things to run Sverto:
5
10
6
11
-[Quarto](https://quarto.org)
7
12
-[Node and the Node Package Manager (npm)](https://nodejs.org)
@@ -11,18 +16,18 @@ Add Svelte visualisations to your Quarto documents
11
16
Install the project extension using:
12
17
13
18
```
14
-
quarto use template 360-info/sverto@firstrelease
19
+
quarto use template 360-info/sverto@firstrelease-docs
15
20
```
16
21
17
-
This will add the extension itself (which includes some project scripts) to the `_extension` folder, as well as a few other files.
18
-
19
22
Then run:
20
23
21
24
```
22
25
npm install
23
26
```
24
27
25
-
This will install everything you need for your Svelte components to work to the `node_modules` folder. You won't need to touch this folder, and it doesn't need to go into version control. It'll also create a `package-lock.json`, which you _should_ version control.
28
+
This will add the extension itself (which includes some project scripts) to the `_extension` folder, as well as a few other files.
29
+
30
+
> **Note:** Sverto depends on running [project pre-render scripts](https://quarto.org/docs/projects/scripts.html#pre-and-post-render), so you can't currently use it with single documents.
26
31
27
32
## 🎉 Use
28
33
@@ -37,10 +42,10 @@ Here's the short way to add Svelte component you've written to a Quarto doc:
37
42
```
38
43
39
44
2. Import your Svelte component with `Component = import_svelte("Component.svelte")`
40
-
3. Add a target block for your visual and give it an `#id`
45
+
3. Add a target block for your visual using `:::` and give it an `#id`
41
46
4. Instantiate the Svelte component with `myVisual = Component.default()` using some default props and your target block
42
47
5. Update the instantiated component with `myVisual.propName`
43
-
6. Render your Quarto project as usual with `quarto render` or `quarto preview`.
48
+
6. Render your Quarto website as usual with `quarto render` or `quarto preview`.
44
49
45
50
**To see this all in practice, check out [`example.qmd`](./example.qmd).**
46
51
@@ -71,4 +76,4 @@ If you'd prefer to compile your own Svelte components instead of letting this ex
71
76
72
77
If you have any problems with the extension, please feel free to [create an issue](https://github.com/360-info/sverto)!
73
78
74
-
Special thanks to [Carlos Scheidegger](https://github.com/cscheid) from [Posit](https://posit.co) for his time and guidance in designing Sverto!
79
+
Special thanks to [Carlos Scheidegger](https://github.com/cscheid) from [Posit](https://posit.co) for his time and guidance getting Sverto working!
0 commit comments