Replies: 3 comments 1 reply
-
Great concept. I’d love to see it in this project. ESBuild is so easy to work with. My team is developing an internal app using TemplUI and ESBuild, and it’s been a smooth experience so far. We have a build system that handles custom CSS, TS, and static assets. Here’s what that looks like…
|
Beta Was this translation helpful? Give feedback.
-
Thanks for the great feedback! I see both sides when it comes to separating the JS logic from the components. On one hand, I think the current structure offers the best developer experience. In my opinion, there’s nothing better DX-wise than self-contained components. Benefits:
On the other hand, I also understand the arguments for building a shared JS file via CLI:
But for me, this is actually the opposite of a good DX. It means, as a user every time I add a new component, I have to rebuild my JS file. That feels slow and error-prone. A middle ground might be: as the maintainer, I just provide a prebuilt, minified Better DX? Yes! Am I missing something? |
Beta Was this translation helpful? Give feedback.
-
I'm working on a global script import per page for now — just one JS file for the whole library, to keep things simple and developer-friendly in the first version. The file is about 400kb (includes the core library, charts.js, floatingUI, and highlight.js). Let’s discuss this further in the issue: #179 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi! The component structure is very clear and easy to follow — great work!
I have a few suggestions that could help improve the developer experience and performance:
📦 Decouple Script Logic from Components
Move the
<script>
section out of the component files into separate.js
files with the same name. Then useesbuild
to bundle everything into a single file namedtemplui.js
(minified in production). This file can be included inindex.templ
.Benefits:
utils.js
can host a commonregisterEvents
function, which components call with theirinitAllComponents
parameterui/components
, andesbuild
can generate the final bundle from that🛠️ Proposed Makefile Additions
Here are three new
make
targets:dev/esbuild
,esbuild
anddev/assets
(note: not yet tested):Let me know what you think!
Beta Was this translation helpful? Give feedback.
All reactions