Skip to content

Instantly share code, notes, and snippets.

@practicingruby
Created May 2, 2009 16:51
Show Gist options
  • Select an option

  • Save practicingruby/105620 to your computer and use it in GitHub Desktop.

Select an option

Save practicingruby/105620 to your computer and use it in GitHub Desktop.
#!/usr/local/bin/ruby
require "rubygems"
require "rake"
require "erb"
def ProcessTemplate(file)
ERB.new(File.read(file)).result(binding)
end
FileList["templates/*.erb"].each do |f|
page = ProcessTemplate(f)
File.open("output/#{File.basename(f).sub('.erb', '.html')}", "w") do |file|
file << ProcessTemplate("layout.erb") { page }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment