Live data from Hacker News

Ruby on Rails: View Components, Storybook and Tailwind - a match made in heaven?

finnian.io

41–44 of 44 posts

Re: Ruby on Rails: View Components, Storybook and Tailwind - a match made in heaven?

#41
post #40
post #28

Earlier quoted context omitted.

I've tried this and, honestly, I don't like it. Reason number one is how verbose it becomes on the templates when you have to pass a "body", it's at least 4 tags... when you have many nested tags it becomes messy. And then the worst offender to me is that it doesn't isolate the context from the parent template (you have to add the 'only' keyword like with includes), etc. I mean, it was my first option until I found S…

Slippers does look interesting - not sure I like the idea of declaring components in a YAML file but otherwise it seems to address the pain points of components. Would be interesting to see how well it integrates with Django forms. I guess Jinja macros are also pretty good as a basis for building components as well, but I've always found switching to Jinja 2 in a Django project to be too much hassle to be worth it.

Agree. I've also tried Jinja macros and despite I was satisfied with that, it feels a lot like you're moving away from the core of dj ago. Suddenly translations don't work.and you need other solutions, templatetags don't work, and most third party libraries are built for Django templates, not Jinja. Definitely not worth it.

Re: Ruby on Rails: View Components, Storybook and Tailwind - a match made in heaven?

#42

Will this get the nod from dhh and make it into Rails? Dhh wdyt?

DHH said no to View Component, previously called ActionView::Component. I think there was another Rails Core that didn't like it much due to its additional complexity or something. But that was in 2019?. May be things have changed.

Re: Ruby on Rails: View Components, Storybook and Tailwind - a match made in heaven?

#43
post #42

Will this get the nod from dhh and make it into Rails? Dhh wdyt?

DHH said no to View Component, previously called ActionView::Component. I think there was another Rails Core that didn't like it much due to its additional complexity or something. But that was in 2019?. May be things have changed.

I think they just said no _at the time_. However, unless DHH adops it, I don't think it will be Rails default.

Re: Ruby on Rails: View Components, Storybook and Tailwind - a match made in heaven?

#44
post #27
post #13

Equivalent for Django?

Slippers: https://mitchel.me/slippers/

Came back to comment on this as I've been giving it some thought. Comparing with Django Components I find Slippers to be much better. The YAML approach doesn't bother me much, as it is very limited.
Post reply on HN