preloading

This commit is contained in:
cupcakearmy
2019-09-29 18:16:01 +02:00
parent 179d718a39
commit 80f048de3a
6 changed files with 48 additions and 27 deletions

11
src/js/swup.js Normal file
View File

@@ -0,0 +1,11 @@
import Swup from 'swup'
import SwupPreloadPlugin from '@swup/preload-plugin';
export default (fn) => {
const swup = new Swup({
plugins: [new SwupPreloadPlugin()],
containers: ['#app']
})
swup.on('contentReplaced', fn)
}