Only run Alpine.start once #3017
hirasso
started this conversation in
3. Feature Ideas
Replies: 1 comment
-
In my opinion, if the plugins are third party's, they should use their own prefix. If they are first party's they won't need to import Alpine as you have full control on the build. |
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
-
Hi there! Please have a look at this codepen: https://codepen.io/hirasso/pen/zYWxVdR
In complex systems with plugins from different parties (like, for example, CMS admin areas), it's quite possible that a few of these plugins could be wanting to make use of a library like alpinejs. This would lead to certain conflicts, one of them being, that
Alpine.start()
is being executed as often as it has been loaded.What do you think about a guard clause inside
Alpine.start()
that would return early if Alpine had already been started?I could imagine some logic like this: https://codepen.io/hirasso/pen/QWmwewM
Beta Was this translation helpful? Give feedback.
All reactions