https://github.com/ghostdevv/svelte-body
Apply styles to the body in routes! Designed to work with Svelte Kit and Routify
https://github.com/ghostdevv/svelte-body
hacktoberfest
Last synced: 12 months ago
JSON representation
Apply styles to the body in routes! Designed to work with Svelte Kit and Routify
- Host: GitHub
- URL: https://github.com/ghostdevv/svelte-body
- Owner: ghostdevv
- License: other
- Created: 2021-09-07T22:52:28.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2023-10-07T22:14:05.000Z (over 2 years ago)
- Last Synced: 2024-04-26T00:42:33.934Z (almost 2 years ago)
- Topics: hacktoberfest
- Language: TypeScript
- Homepage:
- Size: 354 KB
- Stars: 64
- Watchers: 1
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# Svelte Body
Currently in Svelte Kit and Routify, applying styles per page to the body doesn't work. You can't use `:global(body)` since the style tags aren't removed and reapplied on route change. `svelte-body` handles that for you. It's available as an action or component.
# Install
```bash
npm i svelte-body -D
```
This library is made for Svelte 5, if you'd like to use Svelte 3/4 [checkout v1](https://www.npmjs.com/package/svelte-body/v/1.4.0).
# Usage
Just like in regular html you can apply classes with `class=""` and styles with `style=""`.
```svelte
import { Body } from 'svelte-body';