Skip to content

Conversation

@joelhawksley
Copy link
Contributor

.annotate_template_file_names annotates HTML output with template file names

Problem

As a developer, when looking at a page in my web browser, it's sometimes
difficult to figure out which template(s) are being used to render the page.

Solution

config.action_view.annotate_template_file_names adds HTML comments to the
rendered output indicating where each template begins and ends, leveraging the lovely ActionView::Template#short_identifier introduced by @jhawthorn in #35407:

Screen Shot 2020-03-30 at 2 41 39 PM
(Note: Chrome moves any HTML comments outside the html tag to inside body, which is why <!-- END app/views/layouts/application.html.erb --> is shown as being inside body, despite falling after the closing html tag in the document)

Co-authored-by: Aaron Patterson tenderlove@github.com

…e names

As a developer, when looking at a page in my web browser, it's sometimes
difficult to figure out which template(s) are being used to render the page.

config.action_view.annotate_template_file_names adds HTML comments to the
rendered output indicating where each template begins and ends.

Co-authored-by: Aaron Patterson <tenderlove@github.com>
@phoet
Copy link
Contributor

phoet commented Nov 6, 2020

great to see this being added after proposing it 6 years ago 👍

just wanted to leave a comment here, that i'm going to discontinue to support partially_useful the gem adding this functionality for rails > 6.0 for later reference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants