npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

gulp-appcache

v0.0.4

Published

Generate HTML5 Cache Manifest files with relative path

Downloads

128

Readme

gulp-manifest

Generate HTML5 Cache Manifest files. Submitted by Scott Hillman.

Editing

Many thanks to Scott Hillman who developed grunt-manifest for gulpjs. I made few changes in the plugin to support the relative path of the file which are to be cahched.

Big thanks to Gunther Brunner for writing the grunt-manifest plugin. This plugin was heavily influenced by his great work.

Visit the HTML 5 Guide to AppCache for more information on Cache Manifest files.

Usage

npm install gulp-appcache

API

Parameters

manifest(options)

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

options.relativePath

Type: String

Adds the relative path to the file to be caches with hash working as previous.

options.filename

Type: String
Default: "app.manifest"

Set name of the Cache Manifest file.

options.cache

It is not supported in this plugin as the hash does not change with in manifest file.

options.exclude

Type: String Array
Default: undefined

Exclude specific files from the Cache Manifest file.

options.network

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.

options.fallback

Type: String Array
Default: undefined

Adds a string to the FALLBACK section.

See here for more information.

options.preferOnline

Type: Boolean
Default: undefined

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

See here for more information.

options.timestamp

Type: Boolean
Default: true

Adds a timestamp as a comment for easy versioning.

Note: timestamp will invalidate application cache whenever cache manifest is rebuilt, even if contents of files in src have not changed.

options.hash

Type: Boolean Default: false

Adds a sha256 hash of all src files (actual contents) as a comment.

This will ensure that application cache invalidates whenever actual file contents change (it's recommented to set timestamp to false when hash is used).

Usage Example

gulp.task('manifest', function(){
  gulp.src(['../client/resources/build/**/*'])
    .pipe(manifest({
  relativePath: '/resources/build'
      hash: true,
      preferOnline: true,
      network: ['http://*', 'https://*', '*'],
      filename: 'app.manifest',
      exclude: 'app.manifest'
     }))
    .pipe(gulp.dest('build'));
});

Output example

CACHE MANIFEST

CACHE:
/resources/build/js/app.js
/resources/build/css/style
/resources/build/css/style.css
/resources/build/js/zepto.min.js
/resources/build/js/script.js
/resources/build/some_files/index.html
/resources/build/some_files/about.html

NETWORK:
http://*
https://*
*

# hash: 76f0ef591f999871e1dbdf6d5064d1276d80846feeef6b556f74ad87b44ca16a

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.