Skip to content

A swup plugin for integrating Gia frontend componentsĀ šŸ­

License

Notifications You must be signed in to change notification settings

swup/gia-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Ā 

History

62 Commits
Ā 
Ā 
Ā 
Ā 
Ā 
Ā 
Ā 
Ā 
Ā 
Ā 
Ā 
Ā 
Ā 
Ā 
Ā 
Ā 

Repository files navigation

Swup Gia Plugin

A swup plugin for integrating 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.

npm install @swup/gia-plugin
import SwupGiaPlugin from '@swup/gia-plugin';

Or include the minified production file from a CDN:

<script src="https://unpkg.com/@swup/gia-plugin@2"></script>

Usage

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

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

Options

components

Components to be used for mount/unmount. Defaults to an empty object.

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.

new SwupGiaPlugin({ firstLoad: true });

log

Let Gia report info on mounting/unmounting of components. Corresponds to setting the log variable of Gia's config). Defaults to false.

new SwupGiaPlugin({ log: false });