Head Plugin

Plugin serves to replace the contents of head tag when the content of the page is replaced. Primary reason for this can be usage of different style files included with a link for different pages.

Note: This plugin is rather experimental and any improvements or comments are more than welcome.


This plugin can be installed with npm

npm install @swup/head-plugin

and included with import

import SwupHeadPlugin from '@swup/head-plugin';

or included from the dist folder

<script src="./dist/SwupHeadPlugin.js"></script>


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

const swup = new Swup({
  plugins: [new SwupHeadPlugin()]