grunt-contrib-manifest

Precompile Underscore templates to JST file.

grunt-contrib-manifest

Generate HTML5 Cache Manifest files (will become part of the grunt-contrib collection). Submitted by Gunther Brunner.

Install this grunt plugin next to your project's grunt.js gruntfile with: npm install grunt-contrib-manifest

Then add this line to your project's grunt.js gruntfile:

grunt.loadNpmTasks('grunt-contrib-manifest');

Inside your grunt.js file add a section named manifest. Visit the Appcache Facts for more information on Cache Manifest files.

This controls how this task (and its helpers) operate and should contain key:value pairs, see options below.

Sets the input files.

Sets the name of the Cache Manifest file. By default the standard manifest.appcache filename will be used.

Sets the base path. It's recommended to set this.

Exclude specific files from the Cache Manifest file.

Adds a string to the NETWORK section.

By default an online whitelist wildcard "*" flag is added.

See here for more information.

Adds a string to the FALLBACK section.

See here for more information.

Adds a string to the SETTINGS section, specifically the cache mode flag of the prefer-online state.

See here for more information.

Adds a timestamp as a comment for easy versioning. True by default.

manifest: {
  generate: {
    options: {
      basePath: "../",
      network: ["http://*", "https://*"],
      fallback: ["/ /offline.html"],
      exclude: ["js/jquery.min.js"],
      preferOnline: true,
      timestamp: true
    },
    src: [
        "some_files/*.html",
        "js/*.min.js",
        "css/*.css"
    ],
    dest: "manifest.appcache"
  }
}
CACHE MANIFEST
# This manifest was generated by grunt-contrib HTML5 Cache Manifest Generator
# Time: Mon Jan 01 2155 22:23:24 GMT+0900 (JST)
 
CACHE:
css/style.css
js/zepto.min.js
js/script.js
some_files/index.html
some_files/about.html
 
NETWORK:
*
 
  • 2012/09/28 - v0.2.0 - Refactored from grunt-contrib into individual repo.