Switch branches/tags
Find file
Fetching contributors…
Cannot retrieve contributors at this time
92 lines (69 sloc) 2.58 KB


A volo command for generating an appcache manifest.


Install this command via npm into a project's local node_modules directory:

npm install volo-appcache

Then, in the volofile for the project, create a volo command name that does a require() for this command, and pass it the following allowed options:

//in the volofile
module.exports = {
    //Existing build command, not required to use volo-appcache
    build: function () {},

    //Creates a local project command called appcache
    appcache: require('volo-appcache')({
        //Optional array of volofile commands to run before executing
        //this command
        depends: ['build'],

        //The directory to use for the manifest
        //The manifest.appcache will be written
        //inside this directory. Default value is
        dir: 'www-built',

        //The path to the HTML file to modify to add the
        //`manifest` attribute. Path is assumed to be inside
        //the `dir` option mentioned above. Default value
        //is shown:
        htmlPath: 'index.html',

        //The path to the template file to use for the manifest
        //It defaults to the 'manifest.template' file in this
        //directory. Be aware, the volo-appcache command assumes
        //there are some tokens in the file that can be replaced
        //with the file listing and the digest stamp. See
        //manifest.template for an example.
        manifestTemplate: ''

Overriding the basic manifest template

The manifestTemplate option mentioned above allows you to override the basic template used for the manifest. This can be useful if you want to specify extra URLs to cache, or specify fallbacks for some URLs. Here is an example of a template that specifies two other URLs to cache and specifies a fallback for /submit.php:

# {stamp}


# catch-all for anything else

/submit.php offline.html


While in the project directory, just type:

volo appcache

To generate the manifest.appcache in the directory specified above. It will use a digest of all the file contents to stamp the manifest.appcache for changes, and it will modify the htmlPath file listed above to include the manifest attribute on the html tag.


MIT and new BSD.