this looks dope. has anyone built anything substantial with phlex ?
RubyUI (Former PhlexUI): Ruby Gem for RubyUI Components
21–30 of 40 posts
Re: RubyUI (Former PhlexUI): Ruby Gem for RubyUI Components
#22Phlex is an amazing project. Makes frontend fun again. I've built my own UI library using DaisyUI and Tailwindcss that we use in all our Rails projects: https://github.com/inhouse-work/protos It cannot be overstated how nice it is to move away from erb and into pure ruby. Private methods as partials is a game changer for refactoring your UI.
Not a fan of the rails erb helper methods though, so maybe it doesn't count. I almost exclusively use it outside of rails now
Re: RubyUI (Former PhlexUI): Ruby Gem for RubyUI Components
#23Phlex is an amazing project. Makes frontend fun again. I've built my own UI library using DaisyUI and Tailwindcss that we use in all our Rails projects: https://github.com/inhouse-work/protos It cannot be overstated how nice it is to move away from erb and into pure ruby. Private methods as partials is a game changer for refactoring your UI.
I increasingly wonder if I'm the only one left who genuinely likes erb :-D Not a fan of the rails erb helper methods though, so maybe it doesn't count. I almost exclusively use it outside of rails now
Re: RubyUI (Former PhlexUI): Ruby Gem for RubyUI Components
#24Phlex is an amazing project. Makes frontend fun again. I've built my own UI library using DaisyUI and Tailwindcss that we use in all our Rails projects: https://github.com/inhouse-work/protos It cannot be overstated how nice it is to move away from erb and into pure ruby. Private methods as partials is a game changer for refactoring your UI.
Have you had much luck with slots? I have a project using View Components that leverages slots. I've tried migrating to Phlex, but the lack of explicit slot support has been a bit frustrating.
To create them declaratively (not needing to call them in a set order) you just create a module that defines `before_template` and calls `vanish`: https://www.phlex.fun/miscellaneous/v2-upgrade.html#removed-...
Re: RubyUI (Former PhlexUI): Ruby Gem for RubyUI Components
#25Phlex is an amazing project. Makes frontend fun again. I've built my own UI library using DaisyUI and Tailwindcss that we use in all our Rails projects: https://github.com/inhouse-work/protos It cannot be overstated how nice it is to move away from erb and into pure ruby. Private methods as partials is a game changer for refactoring your UI.
I increasingly wonder if I'm the only one left who genuinely likes erb :-D Not a fan of the rails erb helper methods though, so maybe it doesn't count. I almost exclusively use it outside of rails now
It's got a nice path for incremental adoption, so there is no need to go all-in unless you want to. Personally my Rails projects are all 95%+ ruby now.
Another nice knock off effect is that the LSP and integration with my IDE (neovim) is much nicer with Phlex components than it is with ERB.
I also think personally I don't like "magic" spaces like ERB where its hard for me to follow the code path. How does ERB manage multiline blocks with html in them? Hard to understand, harder to explain. To me it feels like there is less to worry about in Phlex where I'm thinking more in Ruby, less in the specifics of the view context.
Re: RubyUI (Former PhlexUI): Ruby Gem for RubyUI Components
#26Re: RubyUI (Former PhlexUI): Ruby Gem for RubyUI Components
#27They claim it’s faster than ERB but only show micro benchmarks. This is basically a form of lying.
This approach stinks for a lot of reasons:
- it adds a ton of pressure on the garbage collector. - the backtraces suck to debug. Ruby is better now than in 2010, but it’s still lame. - your templates are largely static. Yet when it lives as code you can’t cache any of it. An efficient ERB generator is just cached strings concatenations. Very efficient in Ruby.
Finally, Rubyists hate this and it’s why the community is slowly dying. Almost all your frontend should be in JS/JSX at this point. Even the static stuff.
Re: RubyUI (Former PhlexUI): Ruby Gem for RubyUI Components
#28Looks interesting, but I wish there was a way to alias the component names, since every component class, some of which have common names, take root in the global namespace. (though I suspect that easily enough done manually)
It's basically a code generator for adding standard Phlex components to your project, so once you've added a component to your application you can modify it any way you want.
Re: RubyUI (Former PhlexUI): Ruby Gem for RubyUI Components
#29I’m impressed by this project’s progress. It’s more than just a render library. Although they claim it’s 12x faster than ERB, but I couldn’t find their benchmark.
I believe it's referencing this: https://github.com/KonnorRogers/view-layer-benchmarks