Skip to content
This repository has been archived by the owner on Aug 24, 2022. It is now read-only.
/ view_source_map Public archive

Rails plugin to embed template path as HTML comment.

License

Notifications You must be signed in to change notification settings

r7kamura/view_source_map

Repository files navigation

ViewSourceMap

Gem Build Status

Rails plugin to embed template path as HTML comment.

This project has done its job. Use Rails.configuration.action_view.annotate_rendered_view_with_filenames instead.

Usage

Add this line to your application's Gemfile:

group :development do
  gem "view_source_map"
end

Then you can see the rendered HTML contains some comments like this:

<!-- BEGIN app/views/hello/index.html.erb -->
<p>Hello</p>
<!-- END app/views/hello/index.html.erb -->

Disable

Sometimes this adds too much noise to the html when you're developing. There is a simple way to turn it off.

DISABLE_VIEW_SOURCE_MAP=1 rails s

or

<%= render "example_disabled", view_source_map: false %>
<%= render partial: "example_disabled_partial", view_source_map: false %>