# @swup/theme

> Base class for creating swup themes

Latest version **2.1.0** (published 2023-10-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install @swup/theme
pnpm add @swup/theme
yarn add @swup/theme
bun add @swup/theme
```

## Health

**Score 35/100 (D)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 2.1.0 |
| Published | 2023-10-05 |
| First published | 2019-05-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 35.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Georgy Marchuk |
| Maintainers | hirasso, daun, gmrchk |

## Links

- npm: https://www.npmjs.com/package/@swup/theme
- Repository: https://github.com/swup/theme
- Homepage: https://github.com/swup/theme#readme
- Issues: https://github.com/swup/theme/issues
- npm.io page: https://npm.io/package/@swup/theme

## Dependencies (1)

- [@swup/plugin](https://npm.io/package/@swup/plugin.md) ^4.0.0

## Recent versions

- 2.1.0 (latest) — 2023-10-05
- 2.0.0 — 2023-07-26
- 1.0.7 — 2019-05-26
- 1.0.6 — 2019-05-26
- 1.0.5 — 2019-05-26
- 1.0.4 — 2019-05-25
- 1.0.3 — 2019-05-25
- 1.0.2 — 2019-05-19
- 1.0.1 — 2019-05-19
- 1.0.0 — 2019-05-19
- 0.1.9 — 2019-05-04
- 0.1.8 — 2019-05-04
- 0.1.7 — 2019-05-04
- 0.1.6 — 2019-05-04
- 0.1.5 — 2019-05-04
- … 5 more at https://npm.io/package/@swup/theme/versions

## README

# Swup Base Theme

Base class for creating [swup](https://swup.js.org) themes.

## Creating a Theme

To create a new theme, use the official [swup theme template](https://github.com/swup/theme-template).
It comes with detailed instructions and the required tooling.

## Usage

Import the base class and extend your theme from it.

```js
import Theme from '@swup/theme';

export default class ThemeName extends Theme {
  name = 'ThemeName';
  mount() {}
  unmount() {}
}
```

## Development

The official [swup command-line interface](https://github.com/swup/cli) has commands to help with
bundling and linting themes.

```sh
npm install --save-dev @swup/cli
```

### Bundling

Bundle the theme for production using [microbundle](https://github.com/developit/microbundle),
creating ESM and UMD builds.

```bash
# Bundle and transpile code for distribution
swup package:bundle

# Bundle code in watch mode
swup package:dev
```

### Linting & formatting

Lint the theme code using [prettier](https://prettier.io/) and swup's recommended rules.

```bash
# Lint code
swup package:lint

# Fix and format any lint errors
swup package:format
```

### Package info

Check that the themes's package.json file contains the required information for microbundle:
input, output, export map, amd name, etc.

```bash
# Check package info
swup package:check
```

---
_Source: https://npm.io/package/@swup/theme · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
