-
-
Save Epictetus/1067153 to your computer and use it in GitHub Desktop.
Drop this in lib/tasks/haml.rake and run rake haml:assimilate
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 :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