grunt-contrib-manifest

Package renamed to grunt-manifest. Please update your entries.

Precompile Underscore templates to JST file.

npm install grunt-contrib-manifest
9 downloads in the last week
53 downloads in the last month

grunt-contrib-manifest Build Status

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

Getting Started

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');

Overview

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

Parameters

options object

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

src (required) string|array

Sets the input files.

dest (optional) string

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

Options

basePath (optional) string

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

exclude (optional) string|array

Exclude specific files from the Cache Manifest file.

network (optional) string|array

Adds a string to the NETWORK section.

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

See here for more information.

fallback (optional) string|array

Adds a string to the FALLBACK section.

See here for more information.

preferOnline (optional) boolean

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

See here for more information.

timestamp (optional) boolean

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

Config Example

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"
  }
}

Output example

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:
*

Release History

  • 2012/09/28 - v0.2.0 - Refactored from grunt-contrib into individual repo.
npm loves you