-
-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Docs are missing new script injection tools #101
Comments
I was actually thinking of creating a more complete helper that can just be dropped into the If you'd like to take a stab at that given you have experience implementing it in user land, that would be great! |
@huntabyte well, it requires manual changes to Out of curiosity, are there any other use cases that you know of for JS injection into the initially rendered script, like the FOUC here? I wonder if there should be a community standard for these things that you could then use in a hook like this one, with a single |
Why would it require manual changes to |
I don't think that works, since we need to inject javascript to run to read the client's local storage and set the class correctly, no? We don't have access to this at initial render time. My solution is to add the following to app.html:
And the following server-side hook:
|
We'd use a cookie for the server side instead. |
Change Type
Addition
Proposed Changes
Should ideally have an example of how to do this in
hooks.server.ts
, and add docs to the newgenerateSetInitialModeExpression
function.I can take a stab at this later if you'd like.
The text was updated successfully, but these errors were encountered: