Created
August 19, 2011 15:28
-
-
Save shaneriley/1157075 to your computer and use it in GitHub Desktop.
Haml2Html
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
require "hpricot" | |
require "open-uri" | |
Dir.glob('app/views/ui/*.html.haml').sort.each do |file| | |
route = file.gsub(/(\.html\.haml)|(app\/views)/, "") | |
filename = file.gsub(/(app\/views\/ui)|(\.haml)/, "") | |
unless route.match(/\/index/) | |
dom = Hpricot(open("http://localhost:3000#{route}")) | |
`mkdir static` unless File.directory?("static") | |
output = File.new("static#{filename}", "w") | |
output.puts dom | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment