GithubHelp home page GithubHelp logo

cscott / volo-appcache Goto Github PK

View Code? Open in Web Editor NEW

This project forked from volojs/volo-appcache

0.0 2.0 0.0 105 KB

A volo command for generating an appcache manifest

License: Other

JavaScript 100.00%

volo-appcache's Introduction

volo-appcache

A volo command for generating an appcache manifest.

Installation

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
        //shown:
        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:

CACHE MANIFEST
# {stamp}

CACHE:
http://cdnjs.cloudflare.com/ajax/libs/jquery/1.8.2/jquery.min.js
http://cdnjs.cloudflare.com/ajax/libs/json2/20110223/json2.js
{files}

# catch-all for anything else
NETWORK:
*
http://*
https://*

FALLBACK:
/submit.php offline.html

Usage

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.

License

MIT and new BSD.

volo-appcache's People

Contributors

cscott avatar dangmai avatar jrburke avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.