Skip to content
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

HAML support? #99

Open
fauno opened this issue May 8, 2024 · 2 comments
Open

HAML support? #99

fauno opened this issue May 8, 2024 · 2 comments

Comments

@fauno
Copy link

fauno commented May 8, 2024

Hi! I'm not able to render nice_partial with haml, I get a NicePartials::Partial::Section::RequiredError for this:

= render 'partial' do |partial|
  - partial.body do
    = 'hello'
= partial.body.required

From this I understand only ERB is supported? https://github.com/bullet-train-co/nice_partials/pull/45/files#r930773836

@kaspth
Copy link
Contributor

kaspth commented May 20, 2024

Hey! Yeah, I'd like to support HAML as well. If you bundle open nice_partials and replace the regex you linked to with /\byield[\(? ]+(%>|\n|[^:])/ will it then work? Basically injecting \n as the terminator in there.

You should also be able to get NicePartials working for now with a manual yield:

= yield
= partial.body.required

You'd then need that in every partial (which is not ideal, hence why we have the automatic version).

@fauno
Copy link
Author

fauno commented May 21, 2024

I'll try and let you know! One thing I noticed is that even if I don't use other nice_partials features, I still benefit from the implicit yield :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants