Skip to content

Commit

Permalink
fix quicklink
Browse files Browse the repository at this point in the history
  • Loading branch information
akellbl4 committed Nov 9, 2024
1 parent 739b979 commit d6353e1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 17 deletions.
18 changes: 4 additions & 14 deletions hugo/src/js/quicklink.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,10 @@
import { prefetch } from 'quicklink/dist/quicklink.mjs';
import { listen } from 'quicklink';

function start(options = {}) {
prefetch({
window.addEventListener('load', () => {
listen({
ignores: [
(_, elem) => String(elem.getAttribute('href'))[0] === '#',
(_, elem) => elem.matches('[noprefetch]') || elem.closest('[noprefetch]'),
],
...options,
});
}

document.addEventListener('turbolinks:load', start);
document.addEventListener('quicklink', (e) => start(e.detail || {}));

if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', start);
} else {
start();
}
});
3 changes: 0 additions & 3 deletions hugo/webpack.mix.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,4 @@ mix.webpackConfig({
output: {
publicPath: '/build',
},
optimization: {
splitChunks: 'all',
},
})

0 comments on commit d6353e1

Please sign in to comment.