I've been trialing out a lighter ERb syntax and I've posted a proposal about it on ViewComponent if anybody's interested in collaborating on it https://github.com/ViewComponent/view_component/discussions/1839
What it looks like in a nutshell:
\posts.each do |post|
<h1 \class(active: post.active?)>\= post.title</h1>
\end
@soulcutter I think phlex is great and I'm glad it's out there! I like templates though, and I work on apps that use them where phlex is too big of a stretch, we deserve nicer things too
@kaspth I guess I see Phlex as templates! I get where you’re coming from
@soulcutter I mean you're right, they are
@kaspth Have you ever seen mote from Soveran? It has weird backtraces because of how it works (ERB goes to great lengths to preserve newlines to ensure exceptions show correct lines) but the implementation is beautiful and incredibly concise.
Your implementation looks similar to mote in some ways.
ie.
% posts.each do |post|
% end
@adam12 interesting! I didn't know about this, thank you
@ufuk ok I would not have thought there'd be a link to C# on this — I can see what you mean though!
@kaspth view component isn’t my thing so I don’t have a dog this hunt. but being a big fan and advocate of ERB/HTML template and having thoughts/feels about syntax, I thought I’d jump in.
To me the slashes are harsh, aesthetically. They just trigger escaping and regexes to my eyes.
FWIW, if it helps at all, @evanphx and designed and made a templating language called Dang. If there’s anything in Dang that you can use/take/inspo from… it’s yours.
@veganstraightedge this isn't meant just for ViewComponent, but just for anybody who uses ERB. I've been developing it over here for instance: https://github.com/bullet-train-co/nice_partials/pull/91
That's on point! You're escaping from static HTML into dynamic Ruby, so it's meant to highlight where you're doing that a little more.
Oh Dang, that's awesome, thank you!
@veganstraightedge thanks, I haven't had a chance to look yet!
I don't think I want to be a maintainer
@kaspth I don’t blame you
@veganstraightedge I don't even know if my versionif this is going to work, or if people want that
@kaspth this is really cool!