Replies: 1 comment
-
Does the script alpine is being bundled in have defer on it? There isn’t enough info there to know how it should be configured but if you’re installing via npm you should be able to import Alpine and call Alpine.plugin(intersect) before you call Alpine.start() |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello I'm having troubles making x-intersect work. I have a NEAT stack install (netlify, eleventy, alpine, tailwind). I installed alpine via npm and in the .eleventy.js file (config), I have this line to copy alpine from node modules to static dir
"./node_modules/alpinejs/dist/cdn.min.js": "./static/js/alpine.js"
In the alpine file, at the end there is this code:
// packages/alpinejs/builds/cdn.js window.Alpine = src_default; queueMicrotask(() => { src_default.start(); });
But I need to do this before start:
import intersect from "@alpinejs/intersect"; Alpine.plugin(intersect);
I tried using
document.addEventListener("alpine:init", () => {})
but it didn't work.I'm a bit lost. How do I initialise intersect and use it?
Beta Was this translation helpful? Give feedback.
All reactions