You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been thinking about re-usable components in prawn for some years. And it's very hard to get the abstraction level right. Either you are so stringent that it allows for no flexibility, or you are so flexible that the framework you offer doesn't do much.
The same was true for CSS and in Rails. There are many frameworks and different implementations for modular components and they all vary along the spectrum between flexibility and rigidness.
But then viewcomponent.org came along and after many iterations back and forth with the community, a stable API seemed to have been established with slots. It seems to me like the sweet spot after many years of discussion.
I would like to get some feedback on it. I realized there was an official, yet experimental prawn-components gem but it was never really used.
I only know of this other attempt but it's by far not flexible enough. And this other attempt which works with a concept of "outlets". It's similar to slots but the API doesn't strike me as mature as in the popular view component gem.
Then, of course, the risk is that slots will evolve to something fancier again. But I've been using my implementation in several projects and it seemed to allow a balanced flexibility to split apart a PDF into many files with different responsibilities.
Now, I don't think I have the time for a third open-source project 😅, but maybe this is a way to start something productive. Head over to the specs to get a first glimpse maybe?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I've been thinking about re-usable components in prawn for some years. And it's very hard to get the abstraction level right. Either you are so stringent that it allows for no flexibility, or you are so flexible that the framework you offer doesn't do much.
The same was true for CSS and in Rails. There are many frameworks and different implementations for modular components and they all vary along the spectrum between flexibility and rigidness.
But then viewcomponent.org came along and after many iterations back and forth with the community, a stable API seemed to have been established with slots. It seems to me like the sweet spot after many years of discussion.
I took that level of abstraction and implemented it in prawn: https://github.com/halo/prawn-component (it's basically just copy paste of two ruby files).
I would like to get some feedback on it. I realized there was an official, yet experimental prawn-components gem but it was never really used.
I only know of this other attempt but it's by far not flexible enough. And this other attempt which works with a concept of "outlets". It's similar to slots but the API doesn't strike me as mature as in the popular view component gem.
Then, of course, the risk is that slots will evolve to something fancier again. But I've been using my implementation in several projects and it seemed to allow a balanced flexibility to split apart a PDF into many files with different responsibilities.
Now, I don't think I have the time for a third open-source project 😅, but maybe this is a way to start something productive. Head over to the specs to get a first glimpse maybe?
Beta Was this translation helpful? Give feedback.
All reactions