An open API service indexing awesome lists of open source software.

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

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';