3.2.0 • Published 3 months ago

@swup/body-class-plugin v3.2.0

Weekly downloads
165
License
MIT
Repository
github
Last release
3 months ago

Swup Body Class Plugin

A swup plugin for updating the body classname after each page load.

Installation

Install the plugin from npm and import it into your bundle.

npm install @swup/body-class-plugin
import SwupBodyClassPlugin from '@swup/body-class-plugin';

Or include the minified production file from a CDN:

<script src="https://unpkg.com/@swup/body-class-plugin@3"></script>

Usage

To run this plugin, include an instance in the swup options.

const swup = new Swup({
  plugins: [new SwupBodyClassPlugin()]
});

Options

prefix

By default, all classes are updated. If your site uses classes on the body element for functionality like opening menus, you can tell the plugin to only update classnames starting with a prefix, e.g. page-. It will then only update those classes and leave all other classes untouched.

{
  prefix: 'page-'
}
3.2.0

3 months ago

3.1.2

8 months ago

3.1.1

9 months ago

3.1.0

9 months ago

3.0.0

10 months ago

2.0.1

1 year ago

1.0.2

4 years ago

1.0.1

5 years ago

1.0.0

5 years ago