The pull request is now out.
Thank you all for your comments and encouragement. Let's see how it goes from here.
github.com/rails/rails/...
The pull request is now out.
Thank you all for your comments and encouragement. Let's see how it goes from here.
github.com/rails/rails/...
The pull request is now out.
Thank you all for your comments and encouragement. Let's see how it goes from here.
github.com/rails/rails/...
Thank you, and yes, that safe_join technique is what I have been using too.
With the excitement around Hotwire based UI component libraries and Tailwind, I think it’s time to codify that into Rails itself.
This is a proposal for an extension to Rails tag helpers, that will enable us to write slightly more complex HTML in pure Ruby inside our view helpers.
I think it could help us more conveniently write light-weight components.
I welcome any feedback!
dev.to/naofumik/rai...
@skillstopractice.com
I've just published a blog post with more details on the motivation. I also hope to get a PR out soon. Maybe I can nudge you just a bit closer to view helpers 😀
dev.to/naofumik/rai...
Phlex is very good at aligning the two structures. However, by adding a small feature to plain view helpers, I think they can be almost just as good too. I want to discuss this approach.
The point of my proposal is to extend the point at which you need to fall back to ERb. In my experience, the major pain point with tag helpers the Ruby code structure often deviates from the HTML structure.
Thank you. My position is that if we can shift the middle ground just a little bit, we can have view helpers covering most primary/utility components. For example, we could probably write and compose the components in Shadcn with view helpers.
Can you share more details on the + operator approach?
Thank you for the feedback. I fully understand your preference.
Personally, I often do something similar to this using `safe_join`, just to push the limit of helpers so that it encompasses the size of "Components", but I am looking for a better syntax. 😀
Briefly, it will allow you to compose HTML in view helpers like this. Currently, blocks in tag helpers only use the return value so this approach was cumbersome when you had multiple tags. I'm proposing an approach that will make it more like Phlex.
@garrettdimon.com Hello! I just sent you an email regarding your article on ERb and Partials. I have a proposal for improving the helper approach, and I would be very happy if you could give me some feedback.