Globally Inject code into load function #9272
benjaminpreiss
started this conversation in
General
Replies: 1 comment
-
I would probably just build an endpoint. First you have a script that goes and generates your build time data and dump that into some files. Next, you have an endpoint lets say Now in each page, you would basically make a request to |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Dear all,
I have problems finding the right place to insert code into each pages load function depending on the pages parameters.
My page routes are: /[[lang=lang]]/+page.svelte and /[[lang=lang]]/blue/+page.svelte
I want to pass individual (build time generated) data to each of these pages, depending on the lang route parameter.
Now I wonder if there is a single place where I could add rollup plugin maybe or something else to inject my code into the pages load function?
Right now I have been trying to write a rollup plugin, but as far as I know the rollup plugin never sees the real page param.
So where else could I place some code to generate my data that is later accessible in each page?
Looking forward to get some insight!
Beta Was this translation helpful? Give feedback.
All reactions