Generate HTML5 Cache Manifest files


Generate HTML5 Cache Manifest files. Submitted by Gunther Brunner.

This plugin requires Grunt ~0.4.0

If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

npm install grunt-manifest --save-dev

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:


Run this task with the grunt manifest command.

Visit the Appcache Facts for more information on Cache Manifest files.

Task targets, files and options may be specified according to the grunt Configuring tasks guide.

Type: Object
Default: {}

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

Type: String Array

Sets the input files.

Type: String
Default manifest.appcache

Sets the name of the Cache Manifest file.
Remember that .appcache is now the W3C recommended file extension.

Type: String

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

Type: String

Adds manually a string to the CACHE section. Needed when you have cache buster for example.

Type: String Array

Exclude specific files from the Cache Manifest file.

Type: String Array
Default: "*" (By default, an online whitelist wildcard flag is added)

Adds a string to the NETWORK section.

See here for more information.

Type: String Array

Adds a string to the FALLBACK section.

See here for more information.

Type: Boolean

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

See here for more information.

Type: Boolean
Default: true

Adds a meta "copyright" comment.

Type: Boolean
Default: true

Adds a timestamp as a comment for easy versioning.

// Project configuration 
  manifest: {
    generate: {
      options: {
        basePath: "../",
        cache: ["js/app.js", "css/style.css"]
        network: ["http://*", "https://*"],
        fallback: ["/ /offline.html"],
        exclude: ["js/jquery.min.js"],
        preferOnline: true,
        verbose: true,
        timestamp: true
      src: [
      dest: "manifest.appcache"
# This manifest was generated by grunt-manifest HTML5 Cache Manifest Generator
# Time: Mon Jan 01 2155 22:23:24 GMT+0900 (JST)

You do need to be fully aware of standard browser caching. If the files in CACHE are in the network cache, they won't actually update, since the network cache will spit back the same file to the application cache. Therefore, it's recommended to add a hash to the filenames's, akin to rails or yeoman. See here why query strings are not recommended.

  • 2012/10/23 - v0.4.0 - Changed package and repository name to grunt-manifest.
  • 2012/10/23 - v0.3.0 - Upgraded to Grunt 0.4. Fixed dependencies. Fixed basePath.
  • 2012/10/23 - v0.2.1 - Added possibility to manually specify "CACHE:" files. Made comments optional.
  • 2012/09/28 - v0.2.0 - Refactored from grunt-contrib into individual repo.