Skip to content

Odi55555/grunt-contrib-manifest

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

cache (optional) string

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

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.

verbose (optional) boolean

Adds a "copyright" comment. True by default.

timestamp (optional) boolean

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

Config Example

manifest: {
  generate: {
    options: {
      basePath: "../",
      cache: ["js/app.js?rel=3230239039", "css/style?rel=43049"]
      network: ["http://*", "https://*"],
      fallback: ["/ /offline.html"],
      exclude: ["js/jquery.min.js"],
      preferOnline: true,
      verbose: 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:
js/app.js?rel=3230239039
css/style?rel=43049
css/style.css
js/zepto.min.js
js/script.js
some_files/index.html
some_files/about.html

NETWORK:
*

Release History

  • 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.

About

Generates HTML5 Cache Manifest files

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%