-
Notifications
You must be signed in to change notification settings - Fork 445
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add output_preamble
to match existing output_postamble
#1931
Comments
Hey @kdonovan, this seems like a good idea. How do you feel about submitting a PR? |
I went ahead and added a small PR for this. CI is failing... the changes are simple and it looks like it's failing for everyone else, too, but tbh I never got the |
It looks like these test failures are legitimate. I left a comment on the PR. As far as running tests locally, I would recommend getting |
@kdonovan I recently started adding a few things, and also had to get setup, if you need help you can ping me in the PR |
Thanks folks -- just using |
ViewComponent::Base
defines anoutput_postamble
for additional content that will be appended to the rendered string, but currently there is no matching hook for prepended content.Motivation
First is just providing a consistent interface/not falling afoul of the principle of least surprise. But beyond that, I have a use-case where I'd like to wrap every view component in a specific HTML tag (with
data-controller
andclass
attributes set based on the filename, so sidecar stimulus controllers/css modules fromview_component-contrib
can be applied automatically). With the current state of the codebase I can add the closing tag, but there's no way that I can see to inject the opening tag.It looks like a fairly minor change, and I'd be happy to submit a PR if there's interest, but I wanted to see if there's any context I'm missing first.
The text was updated successfully, but these errors were encountered: