Created
April 27, 2013 11:35
-
-
Save wegorich/5472790 to your computer and use it in GitHub Desktop.
erb2haml.rake (put to lib/task/ forder) gems required
gem 'haml-rails' gem 'html2haml'
gem 'hpricot'
gem 'ruby_parser'
This file contains 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
namespace :erb do | |
namespace :to do | |
desc 'Converts all .html.erb files to .html.haml' | |
task :haml do | |
print "looking for erb views..\n" | |
files = `find ./app/views -name *.html.erb` | |
files.each_line do |file| | |
file.strip! | |
print "parsing file: #{file}\n" | |
`bundle exec html2haml #{file} | cat > #{file.gsub(/\.erb$/, ".haml")}` | |
`rm #{file}` | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment