Skip to content

Instantly share code, notes, and snippets.

@wesgarrison
Created September 19, 2010 16:08
Show Gist options
  • Save wesgarrison/586872 to your computer and use it in GitHub Desktop.
Save wesgarrison/586872 to your computer and use it in GitHub Desktop.
class ConvertToHaml
def initialize
@from_path = File.join(File.dirname(__FILE__), 'app', 'views')
end
def convert!
Dir["#{@from_path}/**/*.erb"].each do |file|
puts file
# for each .erb file in the path, convert it & output to a .haml file
`bundle exec html2haml -ex #{file} #{file.gsub(/\.erb$/, '.haml')}`
end
end
end
ConvertToHaml.new.convert!
gem 'ruby_parser'
gem 'hpricot'
gem 'haml'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment