Skip to content

Instantly share code, notes, and snippets.

@Epictetus
Forked from bmarini/haml.rake
Created July 6, 2011 12:52
Show Gist options
  • Save Epictetus/1067153 to your computer and use it in GitHub Desktop.
Save Epictetus/1067153 to your computer and use it in GitHub Desktop.
Drop this in lib/tasks/haml.rake and run rake haml:assimilate
namespace :haml do
desc "Convert all .erb views to .haml"
task :assimilate => :environment do
git = File.exist?( Rails.root.join('.git') )
chdir Rails.root do
Dir["app/views/**/*.erb"].map do |file|
[ file, file.gsub(/\.erb$/, '.haml') ]
end.each do |(erb, haml)|
sh "bundle exec html2haml #{erb} #{haml}"
sh "git rm #{erb} && git add #{haml}" if git
end
end
puts "All your erb are belong to us"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment