Skip to content

Instantly share code, notes, and snippets.

@abachman
Created June 15, 2010 15:06
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 abachman/439234 to your computer and use it in GitHub Desktop.
Save abachman/439234 to your computer and use it in GitHub Desktop.
class ToHaml
def initialize(path)
@path = path
end
def convert!
Dir["#{@path}/**/*.erb"].each do |file|
puts "converting #{file}"
# run html2haml on the input file in erb mode with strict parsing
# on the input (xhtml mode)
`html2haml -ex #{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