Created
March 19, 2012 03:45
-
-
Save dentedtriangle/2093626 to your computer and use it in GitHub Desktop.
ERB to HAML
This file contains hidden or 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
| desc "Creates haml files for each of the erb files found under views (skips existing)" | |
| task :erb2haml do from_path | |
| from_path = File.join(File.dirname(__FILE__), '..', '..', 'app', 'views') | |
| Dir["#{from_path}/**/*.erb"].each do |file| | |
| puts file | |
| # for each .erb file in the path, convert it & output to a .haml file | |
| output_file = file.gsub(/\.erb$/, '.haml') | |
| `bundle exec html2haml -ex #{file} #{output_file}` unless File.exist?(output_file) | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment