/view_source_map

Rails plugin to embed template path as HTML comment.

Primary LanguageRubyMIT LicenseMIT

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 %>