Skip to content

Instantly share code, notes, and snippets.

@kristenhazard
Created May 2, 2012 19:59
Show Gist options
  • Save kristenhazard/2579833 to your computer and use it in GitHub Desktop.
Save kristenhazard/2579833 to your computer and use it in GitHub Desktop.
Configuring rack-offline
Kitfox::Application.routes.draw do
offline = Rails::Offline.configure :cache_interval => 30 do
cache_buster_timestamp = "20120429"
files = Dir[
"#{root}/**/*.html",
"#{root}/stylesheets/**/*.css",
"#{root}/javascripts/**/*.js",
"#{root}/images/**/*.*"]
files.each do |file|
file = file + "?" + cache_buster_timestamp
cache Pathname.new(file).relative_path_from(root)
end
network "*"
end
match "/application.manifest" => offline
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment