Closed timriley closed 2 years ago
I think one major roadblock to this is the missing support in tilt
for blocks in ERB and HAML templates. As far as I understood from my questions in this direction it would be a big effort to make the renderer of dry-view
pluggable so it could be exchanged with the Rails renderer. Parts of Rails view helpers are not usable without block support. Implementing block support for other renderers is far from trivial.
Just wanted to point out that an alternative way of integrating dry-view
in rails is just ditching both the view layer and the controller layer. Ok, ok, maybe you can't say "integrate" here because you are just replacing, but responsibilities in rails between the request/response cycle manager and the template system are quite entangled, so I think it makes sense and it is relevant here.
A nice way to do so is using web_pipe
+ dry_view
(disclaimer: I'm web_pipe
developer). Here it is a short description on how to do so (only the beginning of the article, at the end it is about integrating web_pipe
itself with action_view
):
https://github.com/waiting-for-dev/web_pipe/blob/master/docs/extensions/rails.md
We have an
examples/rails/
example app in this repo, which demonstrates a very barebones integration. For better usage within Rails, we need a dry-view-rails integration gem providing a railtie, support for conventional paths, template/code reloading, etc.To get started, you could copy the structure of the dry-system-rails gem.