Skip to content

Instantly share code, notes, and snippets.

@anfleene
Created May 26, 2011 20:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anfleene/994046 to your computer and use it in GitHub Desktop.
Save anfleene/994046 to your computer and use it in GitHub Desktop.
A monkey patch to include an html comment where a template starts and stops in development mode for rails
Haml::Engine.class_eval do
alias_method :initialize_without_file_comments, :initialize
def initialize(template, options ={})
template = template.dup
template.insert(0,"/ BEGIN #{options[:filename]}\n")
template.insert(-1,"\n/ END #{options[:filename]}")
template.freeze
initialize_without_file_comments(template, options)
end
end if Rails.env.development?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment