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

Support of "annotate_template_file_names" or equivalent #180

Closed
ghost opened this issue Mar 23, 2021 · 2 comments
Closed

Support of "annotate_template_file_names" or equivalent #180

ghost opened this issue Mar 23, 2021 · 2 comments

Comments

@ghost
Copy link

ghost commented Mar 23, 2021

Recently in Rails 6.1 was introduced option to annotate rendering of templates with some debug comments.
Internally such behavior is handled by actionview/lib/action_view/template/handlers/erb/erubi.rb :

if ActionView::Base.annotate_template_file_names
  properties[:preamble]   = "@output_buffer.safe_append='<!-- BEGIN #{properties[:short_identifier]} -->\n';"
  properties[:postamble]  = "@output_buffer.safe_append='<!-- END #{properties[:short_identifier]} -->\n';@output_buffer.to_s"
else
  properties[:preamble]   = ""
  properties[:postamble]  = "@output_buffer.to_s"
end

rails/rails#38848
That's very useful developer-time-saving feature, especially on projects with complex layouts.

Is there any way to enable behavior like this in hamlit?
(register callback, additional prefix handler, etc)

@k0kubun
Copy link
Owner

k0kubun commented Mar 24, 2021

Done. Please try v2.14.5.

@ghost
Copy link
Author

ghost commented Mar 24, 2021

@k0kubun , just updated gem. Works perfectly.
That's awesome!
Thank you very much. 🎂

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

1 participant