Changing view component directory? #1341
-
This is a great project, thank you for open sourcing it. I was wondering if it was possible to define the HTML for the component in the views folder, rather than app/views? I didn't see a way to configure this in the documentation. I like having all my "view stuff" in one place, and having it tucked alongside my Ruby code in app seems off to me. Thanks for any help! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Hi @gjtorikan! I like this as a suggestion. It's not currently possible to have the templates and corresponding Ruby classes in separate locations in ViewComponent, as far as I'm aware — the closest thing would be to set the Since components are the sum of their template, Ruby class, and associated assets, they're all colocated in |
Beta Was this translation helpful? Give feedback.
-
Coming back to this discussion, I'm generally hesitant to have ViewComponent Ruby and template files in different locations. I think it makes the most sense to consumers to have them in the same location due to how the ViewComponent Ruby class wraps the compiled template: https://viewcomponent.org/how-it-works.html |
Beta Was this translation helpful? Give feedback.
Coming back to this discussion, I'm generally hesitant to have ViewComponent Ruby and template files in different locations. I think it makes the most sense to consumers to have them in the same location due to how the ViewComponent Ruby class wraps the compiled template: https://viewcomponent.org/how-it-works.html