All Articles

Rake task Convert erb to haml

save as haml.rake to lib/tasks/

namespace 'views' do
	desc 'Convert rails2.0 views to haml'
		task 'convert_to_haml' do
			Dir.glob('app/views/**/*.erb').each do |file|
				system "html2haml -r #{file} #{file.gsub(/\.erb$/, '.haml')}"
			end
		end
	end
end

run cmd : rake views:converttohaml install haml plugin into your rails app, run cmd : haml —rails path/to/your/app