Skip to content

Instantly share code, notes, and snippets.

@shaneriley
Created August 19, 2011 15:28
Show Gist options
  • Save shaneriley/1157075 to your computer and use it in GitHub Desktop.
Save shaneriley/1157075 to your computer and use it in GitHub Desktop.
Haml2Html
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