Skip to content

Instantly share code, notes, and snippets.

@jeroenvandijk
Created October 17, 2011 09:29
Show Gist options
  • Save jeroenvandijk/1292282 to your computer and use it in GitHub Desktop.
Save jeroenvandijk/1292282 to your computer and use it in GitHub Desktop.
Middleman and Rack-Offline for app manifests
require 'rack/offline'
offline = Rack::Offline.configure do
cache "app.js"
cache "app.css"
# etc ..
end
map("/offline.appcache") { run offline }
# We need to add this page declaration to force middleman to include the manifest in a build
page "/offline.appcache", :proxy => "offline.appcache"
gem 'rack-offline'
@siebertm
Copy link

page "/offline.appcache", :proxy => "offline.appcache"

Doesn't work, the error says "Can't proxy a page to itself". One way to get this to work is to just create an empty file source/offline.appcache. This then gets picked up by the build process and triggers Rack::Offline

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment