- Implement Bulma
- Get URL params in dynamic pages
First of all you want to donwload all the packages that will be used.
npm i -D bulma (moment chart.js rollup-plugin-css-only) (npm i axios)
- In
rollup.config.js
you shouldimport css from 'rollup-plugin-css-only
on the top. Then, in the client plugins add a new one:css({ output: 'static/extra.css' })
. To not forget to comma. - In
src/client.js
you canimport 'bulma/css/bulma.min.css
. I just discovered I can track what I'm importing, I just have to take a walk in the node_modules. - Finally insert
<link rel="stylesheet" href="extra.css" />
insrc/template.html
. - Run the dev-server and drop a look in the network tab;
extra.css
should be donwloaded with the rest. If so, Bulba is correctly implemented in your project.
- You create a
[state].svelte
in the routes folder.
<script context="module">
export async function preload(page) {
console.log(page);
return { state: page.params["state"] };
}
</script>
<script>
export let state
</script>
<h1>{state}</h1>
If you get to /my-test
on the page there will be written my-test