Giter VIP home page Giter VIP logo

svelte-html's Introduction

@jill64/svelte-html

npm-version npm-license npm-download-month npm-min-size ci.yml website

๐Ÿท๏ธ Declarative attribute binding for the root html element

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

svelte-html's People

Contributors

wraith-ci[bot] avatar renovate[bot] avatar jill64 avatar github-actions[bot] avatar dependabot[bot] avatar

Stargazers

Muh. Sukrillah avatar

Watchers

 avatar

svelte-html's Issues

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Edited/Blocked

These updates have been manually edited so Renovate will no longer make changes. To discard all commits and start over, click on a checkbox.

Detected dependencies

github-actions
.github/workflows/ci.yml
  • jill64/.github main
  • jill64/playwright-config v2.4.1@164f3196faa6d87424822469d554d5a1ad7464ac
npm
package.json
  • @jill64/eslint-config-svelte 1.3.5
  • @jill64/npm-demo-layout 1.0.225
  • @jill64/universal-sanitizer 1.3.1
  • @jill64/playwright-config 2.4.1
  • @jill64/prettier-config 1.0.0
  • @jill64/sentry-sveltekit-cloudflare 1.7.16
  • @playwright/test 1.46.1
  • @sveltejs/adapter-cloudflare 4.7.2
  • @sveltejs/kit 2.5.25
  • svelte 4.2.19
  • svelte-feather-icons 4.1.0
  • typescript 5.5.4
  • vite 5.4.2
  • vitest 2.0.5
  • @sveltejs/vite-plugin-svelte 3.1.2
  • @sveltejs/kit ^2.0.0
  • svelte ^4.0.0

  • Check this box to trigger a request for Renovate to run again on this repository

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.