Skip to content

Commit

Permalink
Merge pull request #16 from swup/updates
Browse files Browse the repository at this point in the history
Updates
  • Loading branch information
daun authored Oct 5, 2023
2 parents 7a05658 + 8a8eb08 commit ce6e723
Show file tree
Hide file tree
Showing 6 changed files with 4,615 additions and 1,670 deletions.
8 changes: 5 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Changelog

<!-- ## [Unreleased] -->
## [2.1.0] - 2023-09-19

- Port to TypeScript
- Switch to `@swup/cli` for bundling

## [2.0.0] - 2023-07-26

Expand All @@ -11,7 +14,6 @@

- Initial release

[Unreleased]: https://github.com/swup/theme/compare/2.0.0...HEAD

[2.1.0]: https://github.com/swup/theme/releases/tag/2.1.0
[2.0.0]: https://github.com/swup/theme/releases/tag/2.0.0
[1.0.0]: https://github.com/swup/theme/releases/tag/1.0.0
38 changes: 24 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@ 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.
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';

Expand All @@ -18,39 +21,46 @@ export default class ThemeName extends Theme {
}
```

## Commands
## Development

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

The base theme provides a few simple command line tools to help with bundling and linting.
```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.
Bundle the theme for production using [microbundle](https://github.com/developit/microbundle),
creating ESM and UMD builds.

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

# Bundle theme code in watch mode
swup-plugin dev
# 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 theme code
swup-plugin lint
# Lint code
swup package:lint

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

### Package info

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

```bash
# Check theme package info
swup-plugin check
# Check package info
swup package:check
```
Loading

0 comments on commit ce6e723

Please sign in to comment.