Created
May 26, 2011 20:48
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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