-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Adding <body> CSS classes and <html> attributes #2336
Comments
so You create issue about "BUG/feature" that You don't even know if exist in Svelte? Well, You know, this issue is already solved, because it works. The problem is only HTML attributes that are already covered by other issues and also RFC: sveltejs/rfcs#55 so this issue is totally useless. Please create issues only when You check if bug really exist, or feature is really missing. And close this one. This is just duplicate issue. |
Just as a quicktip (apart from svelte): You have javascript on your hand. You have access to the |
@benbender actually, SSR has hindered you from just use DOM API, because SvelteKit is also about isomorphic/universal applications, so we need to have the ways to do some things on both - client and server - sides universally. |
FYI there now exists svelte-body package. I consider this issue closed with this addon package. |
Describe the problem
Some CSS styling techniques and external JavaScript integrations require one to add classes on
<body>
.I do not know if this is possible because the current
%svelte.body%
is wrapped within the<div>
(at least on the starter template):Another common feature is add attributes on
<html>
itself, like<html lang="fi">
. This is especially important for SSR pages, as locale specific SEO optimisations are somewhat important.I see this otpic been discussed in Svelte issue tracker before:
Describe the proposed solution
Because the SvelteKit has the concept of a page the issue could be solved on a page level, making the solution more straightforward than a generic Svelte solution.
Output could contain hooks allowing modifying both
<html>
and<body>
.I do not, however, know if Svelte internals has enough flexibility to allow this.
Alternatives considered
Solve this issue on Svelte level. However, it seems like there hasn't been any progress on this over two years.
Importance
nice to have
Additional Information
No response
The text was updated successfully, but these errors were encountered: