-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from swup/next
Update for swup 4
- Loading branch information
Showing
13 changed files
with
5,704 additions
and
7,280 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Changelog | ||
|
||
<!-- ## [Unreleased] --> | ||
|
||
## [2.0.0] - 2023-07-26 | ||
|
||
- Switch to microbundle | ||
- Export native ESM module | ||
- Update for swup 4 compatibility | ||
- Require Gia as peer dependency | ||
- Use swup's container option to find components | ||
|
||
## [1.0.0] - 2019-05-21 | ||
|
||
- Initial release | ||
|
||
[Unreleased]: https://github.com/swup/gia-plugin/compare/2.0.0...HEAD | ||
|
||
[2.0.0]: https://github.com/swup/gia-plugin/releases/tag/2.0.0 | ||
[1.0.0]: https://github.com/swup/gia-plugin/releases/tag/1.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# Swup Gia Plugin | ||
|
||
A [swup](https://swup.js.org) plugin for integrating | ||
[Gia](https://www.npmjs.com/package/gia) frontend components. | ||
|
||
Automatically reloads components when required only for the replaced containers. | ||
|
||
## Installation | ||
|
||
Install the plugin from npm and import it into your bundle. | ||
|
||
```bash | ||
npm install @swup/gia-plugin | ||
``` | ||
|
||
```js | ||
import SwupGiaPlugin from '@swup/gia-plugin'; | ||
``` | ||
|
||
Or include the minified production file from a CDN: | ||
|
||
```html | ||
<script src="https://unpkg.com/@swup/gia-plugin@2"></script> | ||
``` | ||
|
||
## Usage | ||
|
||
To run this plugin, include an instance in the swup options. | ||
|
||
```javascript | ||
const swup = new Swup({ | ||
plugins: [new SwupGiaPlugin()] | ||
}); | ||
``` | ||
|
||
## Options | ||
|
||
### components | ||
|
||
Components to be used for mount/unmount. Defaults to an empty object. | ||
|
||
```javascript | ||
import Component from 'gia/Component' | ||
|
||
class ExampleComponent extends Component { | ||
// ... | ||
} | ||
|
||
const components = { | ||
ExampleComponent | ||
} | ||
|
||
const swup = new Swup({ | ||
plugins: [new SwupGiaPlugin({ components })] | ||
}) | ||
``` | ||
|
||
### firstLoad | ||
|
||
Whether the components should be loaded on start. Defaults to `true`. | ||
|
||
```javascript | ||
new SwupGiaPlugin({ firstLoad: true }); | ||
``` | ||
|
||
### log | ||
|
||
Let Gia report info on mounting/unmounting of components. Corresponds to setting the `log` variable | ||
of [Gia's config](https://github.com/giantcz/gia#config)). Defaults to `false`. | ||
|
||
```javascript | ||
new SwupGiaPlugin({ log: false }); | ||
``` |
Oops, something went wrong.