render-appcache-manifest
v0.3.0
Published
Renders HTML5 application cache manifest.
Downloads
6
Readme
render-appcache-manifest
Renders HTML5 application cache manifest.
See also parse-appcache-manifest.
Usage
renderManifest = require "render-appcache-manifest"
renderManifest(contents)
renderManifest
returns the rendered manifest as a string.contents
is an object that can have the following properties, all optional:
cache
- an array of entries (urls) you want in theCACHE
section.network
- an array of entries (urls or url-patterns, using wildcards) you want in theNETWORK
sectionfallback
- an object with key-value pairs where key is the url or url-pattern to capture, and value is the fallback url. They will appear in theFALLBACK
section.unique
- if set to a truthy value, will add result ofMath.random()
as a comment, guaranteeing uniqueness.lastModified
- aDate
object. Will be used to generate a "Last modified at" comment.comment
- a comment string.comments
- an array of comment strings, each comment will take up one line.
There's no way to control layout of the generated manifest. The output will be generally neat.
render-appcache-manifest will not validate the correctness of input. You are responsible for providing corrent urls or url-patterns, where appropriate. Also, adding a multi-line string as a comment will break the manifest.
Credits
The initial structure of this module was generated by Jumpstart, using the Jumpstart Black Coffee template.
License
render-appcache-manifest is released under the MIT License.
Copyright (c) 2013 Meryn Stol