Skip to content

Commit

Permalink
added appcache template
Browse files Browse the repository at this point in the history
  • Loading branch information
jstrimpel committed Feb 5, 2012
1 parent 438d0a8 commit 0150e83
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 12 deletions.
13 changes: 13 additions & 0 deletions tools/manifest.appcache
@@ -0,0 +1,13 @@
CACHE MANIFEST
# {stamp}

CACHE:
js/app.js
js/require.js
{files}

# catch-all for anything else
NETWORK:
*
http://*
https://*
27 changes: 15 additions & 12 deletions volofile
Expand Up @@ -72,18 +72,21 @@ define(function (require) {
},

cache: function (d, v, namedArgs) {
var appfiles = v.getFilteredFileList('www-built'),
manifest = 'CACHE MANIFEST\n\n';

appfiles = appfiles.map(function (file) {
var start = file.indexOf('/www-built/');
start = (start !== -1) ? (start + 11) : 0;
return file.substr(start, file.length);
});

manifest += appfiles.join('\n');
manifest += ('\n#' + new Date().getTime()) // cache buster
v.write('./manifest.appcache', manifest);
require(['text!./tools/manifest.appcache'], function (manifest) {
var appfiles = v.getFilteredFileList('www-built'),
buffer = '';

appfiles = appfiles.map(function (file) {
var start = file.indexOf('/www-built/'), file;
start = (start !== -1) ? (start + 11) : 0;
return file.substr(start, file.length);
});

manifest = manifest.replace(/{files}/, appfiles.join('\n'));
manifest = manifest.replace(/{stamp}/, new Date().getTime()); // cache buster

v.write('www-built/manifest.appcache', manifest);
});
}
};
});

0 comments on commit 0150e83

Please sign in to comment.