by stevage · 1y ago · 0 comments
``` li.card.card-body.fw-bold.small(v-if="items.length > 2" v-for="{ id, text } in items" :key="id") | {{ text }} ```
Personally I find this really readable. The HTML element is the most visible thing, then we get classes, then all the logic in parentheses. Then, standing by itself, the content. And we don't need any closing tag.
It also makes debugging harder because there’s a heavier translation of stuff you see in dev tools vs your codebase. It also makes gripping and automated project code replacement harder.
You also can’t easily copy paste HTML code examples from other places. Other developers have to learn and might resist it so you have a mix of template systems.
I could keep going…
I have never needed to move pug code to non pug. If I switched from Vue to Svelte I'd keep using Pug.
I have sometimes needed to do the opposite. There are tools to automate it, but even manually it's much less effort than say converting Vue to React.
Lastly, the promise of your comment, that technical debt is always an important consideration in all projects, is not correct.
There's a million considerations.
Ruby on Rails went through this over a decade with HAML with wide scale adoption and it was largely a mistake, projects always end up moving back to HTML. Or into JSX or whatever HTMLy syntax.
I've worked on at least 3 or 4 projects that switched JS frameworks and stuff like pug would always be burden on moving over.
Ive been down that rabbithole enough times and it's simply not worth the mostly overstated DX benefit. Nerds trying to be hyper efficient in the wrong ways.
Simpler and closer to standards is always always better.
> There's a million considerations.
Exactly. I'm speaking from my experience in my situations.
> dmix 22 hours ago | parent | context | flag | on: Svelte5: A Less Favorable Vue3
How big is your team? How many people touch it? Are you leaving it for the next developer to deal with after you leave? Have you dealt with hiring? Does your platform 100% stay in JS/pug or do you mix it with backend views?
There's a million considerations.
> Ruby on Rails went through this over a decade with HAML with wide scale adoption and it was largely a mistake, projects always end up moving back to HTML.
No they don't. Perhaps the most visible projects do. Perhaps there is an overall trend. Even if projects change from one tech to another, it doesn't mean the original choice was a mistake.
>Ive been down that rabbithole enough times and it's simply not worth the mostly overstated DX benefit.
[to you]
I have not seen any statements about Pug's "DX benefit" to know, but I do find I greatly prefer it, to the point where I'm willing to put in the work to enable Pug in any project I'm allowed to.
> Nerds trying to be hyper efficient in the wrong ways.
Just throwing a needless insult out there?
>Simpler and closer to standards is always always better.
"Always always" is never never right.
> Simpler and closer to standards is always always better.
I don’t entirely disagree, but if it’s fewer migrations between stuff and less churn that you’re after, at that point you might either:
A) go in the direction of something like HTMX for suitable problems (or tbh most SSR approaches without the complexity of neither SPAs nor hydration)
B) alternatively find the most milquetoast yet batteries included option out there, like Angular (and hope that something like AngularJS doesn’t happen)
const elToolbar = generateToolbar(toolbarItems) // returns JSX
const elUserCards = users.map(user => <div class="card card-body fw-bold">{{ user.name }}</div>)
return <div>
{elToolbar}
{elUserCards}
</div>
I find doing something similar with Vue HTML templates has far too much boilerplate, and I have to learn/recall all this Vue specific boilerplate instead of using regular functions so I end up not breaking up my HTML as much. Unless there's a way to do something similar within in a single file?https://github.com/pugjs/pug/activity
That is not necessarily a bad thing, sometime stability is what matters the most. But here the last commit was removal of a security and bugs branch...
The main problem with pug is that, AFAIK, vue is the only modern webframework with stable support for it.