Skip to content

Instantly share code, notes, and snippets.

@threadhead
Created February 10, 2010 22:25
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 threadhead/300918 to your computer and use it in GitHub Desktop.
Save threadhead/300918 to your computer and use it in GitHub Desktop.
# blatantly copied from: http://snippets.dzone.com/posts/show/5449
# but changed to use hamlify instead of html2haml
# A little script to convert all your .erb views to .haml using hamlify,
# which is included with Haml installation.
# Just drop this in your rails root folder and run it.
class ToHaml
def initialize(path)
@path = path
end
def convert!
Dir["#{@path}/**/*.erb"].each do |file|
`hamlify #{file} #{file.gsub(/\.erb$/, '.haml')}`
end
end
end
path = File.join(File.dirname(__FILE__), 'app', 'views')
ToHaml.new(path).convert!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment