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;
Overview
Inside your grunt.js
file add a section named manifest
.
Visit the Appcache Facts for more information on Cache Manifest files.
Parameters
object
options This controls how this task (and its helpers) operate and should contain key:value pairs, see options below.
string|array
src (required) Sets the input files.
string
dest (optional) Sets the name of the Cache Manifest file.
By default the standard manifest.appcache
filename will be used.
Options
string
basePath (optional) Sets the base path. It's recommended to set this.
string|array
exclude (optional) Exclude specific files from the Cache Manifest file.
string|array
network (optional) Adds a string to the NETWORK section.
By default an online whitelist wildcard "*"
flag is added.
See here for more information.
string|array
fallback (optional) Adds a string to the FALLBACK section.
See here for more information.
boolean
preferOnline (optional) Adds a string to the SETTINGS section, specifically the cache mode flag of the prefer-online
state.
See here for more information.
boolean
timestamp (optional) 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: truetimestamp: truesrc:"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.