Replies: 1 comment 5 replies
-
each component should only need to be defined once and it can be re-used. i don't think the docs have gotten very clear yet about patterns for exporting / importing but I think basically the idea was to define an ecmascript module that defines everything it needs when loaded, so that you just write the script import then put the custom element wherever you want it. there should be an example of that somewhere, maybe @snuggs can help point to it. in your example, i think the issue could be just that you're loading the script after using the element, whereas i think you may need to import the definition first before use, but i could be mistaken about that. |
Beta Was this translation helpful? Give feedback.
-
To build a Snuggsi component I can just do
and it's going to work in that spot. But what if I want to reuse
<x-count count=7></x-count>
in another place? The way I understand the docs, I would have to re-declare the markup everywhere I need the component, and Snuggsi is more of an Alpine equivalent than a LitElement one.What is the recommended way to pack the component into a single
.js
file so I can do?
Beta Was this translation helpful? Give feedback.
All reactions