Skip to content

Library that dynamically changes the attributes of html and body tags with SvelteKit's SSR

License

Notifications You must be signed in to change notification settings

kosei28/svelte-attr

Repository files navigation

svelte-attr

svelte-attr is a library that dynamically changes the attributes of html and body tags with SvelteKit's SSR.

Install

npm install svelte-attr

Usage

// src/hooks.server.ts

import type { Handle } from '@sveltejs/kit';
import { svelteAttr } from 'svelte-attr';

export const handle: Handle = async ({ event, resolve }) => {
    return svelteAttr(resolve(event));
};
<script lang="ts">
    import { HtmlAttr, BodyAttr } from 'svelte-attr';
</script>

<HtmlAttr lang="en" />
<BodyAttr data-theme="dark" />

About

Library that dynamically changes the attributes of html and body tags with SvelteKit's SSR

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published