Using Vite to prepare an app shell for Go/Templ/htmx/Alpine stack? #19500
Unanswered
IngwiePhoenix
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello there!
I am a little puzzled at Vite's config right now, perhaps just having a bit of a braindead moment... sorry if this seems a little wonky. ^^;
Basically, I have picked my tools: Templ, HTMX, AlpineJS. These three are pretty neat, but need a baseline - a "shell" if you will. And I would like to serve that shell using my Go router (Chi) so I can stay confortably in the backend and write my UI this way.
But, a little bit of frontent-y stuff is needed regardless; and in this case, I need to render my shell together with it's dependencies into a
dist/
folder, which I can then//go:embed
.The shell is straight forward:
Here,
{{ . }}
is literally the placeholder for "everything" that is rendered with Templ. The referencedindex.js
is equally simple:This will later include AlpineJS and possible plugins - and that's it, that'll be the entire frontend code I will be putting there.
But, how do I just feed that HTML into Vite and render everything into
dist/
?...because there is one more problem. The app I am trying to build will have to include polyfills (using the legacy plugin) to work on older and less frequently (or impossible to upgrade) devices. How do I slot that plugin in...?
Would love if you could give me a pointer - I probably just managed to read myself silly and now I can't see the forest for the trees. @.@
Thank you very much and kind regards,
Ingwie
Beta Was this translation helpful? Give feedback.
All reactions