Imagine you have an example named foo
- go inside
examples
.
This rust file has to define a showcase() -> impl IntoView
function
Inside this file, you define:
-
a
description: String
field. This is one sentence describing the example, a bit longer than a commit message You cannot use markdown in this field -
a
motivation: String
field This is one paragraph that explain to the reader why you wrote this example. Is is to illustrate some functionnality of leptos ? to show some usefull pattern ? to provide a specific component ?
You can use markdown, but without headers.
- a
features: Vec<String>
field: the leptos features that must be declared in cargo for the project to compile. You can ommit thecsr
feature since it is enabled inside each example
optionnaly, a related
field to provide links to documentation.
This can be internal, like [counter](./counter)
Or external, like <https://https://leptos-rs.github.io/leptos/>
optionnaly a dependencies
field for other dependencies
If you need specific dependencies, add them to Cargo.toml
If your example needs a specific stylesheet, add a foo.css
file with the content you want.
It is not supported right now.
Css use stylist, so refer to their docs for the supported syntax.
For the most part, you can use regular css
Look at build.rs
and the generated src/examples.rs
, it should make sense