Last active
December 15, 2015 11:49
-
-
Save nathansmith/5256203 to your computer and use it in GitHub Desktop.
Used to cache-bust <html manifest="..."> locally. Turns static when deployed.
This file contains hidden or 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
# Used to cache-bust <html manifest="..."> locally | |
def manifest_time | |
t = Time.now | |
year = t.year | |
month = t.month | |
day = t.day | |
hour = t.hour | |
min = t.min | |
# Seconds changes too frequently for | |
# manifest, so HH:MM:00 or HH:MM:30. | |
sec = t.sec > 30 ? 0 : 30 | |
# Outputs this format... 2013-03-27 12:11:00 UTC | |
return Time.utc(year, month, day, hour, min, sec) | |
end |
This file contains hidden or 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
CACHE MANIFEST | |
# LAST UPDATED: <%= manifest_time %> | |
#---------------------------------------------------------------------------------------------------- | |
# | |
# INTERNET CONNECTION REQUIRED... | |
# | |
NETWORK: | |
../json | |
#---------------------------------------------------------------------------------------------------- | |
# | |
# CACHE THESE FILES OFFLINE... | |
# | |
CACHE: | |
# | |
# CSS | |
# | |
../stylesheets/application.css | |
# | |
# JavaScript | |
# | |
../javascripts/jquery.js | |
../javascripts/application.js | |
# | |
# HTML | |
# | |
../whatever.html | |
# | |
# Images | |
# | |
../images/whatever.png |
This file contains hidden or 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
<!DOCTYPE html> | |
<html lang="en" manifest="./offline/manifest.appcache"> | |
<head> | |
<meta charset="utf-8" /> | |
<meta http-equiv="x-ua-compatible" content="ie=edge" /> | |
<title> | |
Manifest Example | |
</title> | |
<link rel="stylesheet" href="./stylesheets/application.css" /> | |
</head> | |
<body> | |
<p> | |
Just an example. | |
</p> | |
<script src="./javascripts/application.js"></script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment