Created
October 17, 2011 09:29
-
-
Save jeroenvandijk/1292282 to your computer and use it in GitHub Desktop.
Middleman and Rack-Offline for app manifests
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 '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" |
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
gem 'rack-offline' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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