1.1.15 • Published 9 days ago

@jill64/svelte-html v1.1.15

Weekly downloads
-
License
MIT
Repository
github
Last release
9 days ago

@jill64/svelte-html

🏷️ Declarative attribute binding for the root html element

Demo

Installation

npm i @jill64/svelte-html

Usage

By passing a key-value set to the <SvelteHTML /> component, attributes are bind to the root html element.

<script>
  import { SvelteHTML } from '@jill64/svelte-html'
</script>

<SvelteHTML lang="en" prefix="example" />

↓

<html lang="en" prefix="example">
  <!-- ... -->
</html>

SSR

Attribute binding with <SvelteHTML> is only applied on the client. To assign arbitrary attributes during SSR, use the apply function in the handle hook.

// hooks.server.js
import { apply } from '@jill64/svelte-html'

export const handle = async ({ event, resolve }) => {
  // ...
  return resolve(event, {
    transformPageChunk: apply({
      lang: 'en',
      prefix: 'example'
    })
  })
}

License

MIT

1.1.15

9 days ago

1.1.14

20 days ago

1.1.13

30 days ago

1.1.12

1 month ago

1.1.11

1 month ago

1.1.10

2 months ago

1.1.9

2 months ago

1.1.8

3 months ago

1.1.7

3 months ago

1.1.6

3 months ago

1.1.5

4 months ago

1.1.4

4 months ago

1.1.3

4 months ago

1.1.2

5 months ago

1.1.1

5 months ago

1.1.0

5 months ago

1.0.0

6 months ago

0.3.0

6 months ago

0.2.1

6 months ago

0.2.0

6 months ago

0.1.0

6 months ago

0.0.1

6 months ago