Ready to take your JavaScript development to the next level? Meet npm Enterprise - the ultimate in enterprise JavaScript. Learn more »

manifester

2.0.0 • Public • Published

Manifester

A fingerprint manifest reader.

Reads a JSON manifest (generated by e.g. https://github.com/sindresorhus/gulp-rev/) and returns a function you can use in your views to reference the fingerprinted file path while in development and production.

Installation

$ npm install manifester

Example

var assetPath = require('manifester')('./path/to/manifest.json', {localPath: '/assets'});
 
assetPath('test.js') // => '/assets/test.js'
 
var prodAssetPath = require('manifester')('./path/to/manifest.json', {cdnUrl: 'https://d3.cloudfront.net/assets', env: 'production'});
 
prodAssetPath('test.js') // => 'https://d3.cloudfront.net/assets/test-c27904c624.js'

Usage

var assetPath = require('manifester')('./path/to/manifest.json', {
  env: 'string', // defaults to process.env.NODE_ENV and falls back to 'development'
  localPath: 'string', // defaults to /, used only in development
  cdnUrl: 'string' // no default. falls back to localPath if not provided.
});

License

MIT

install

npm i manifester

Downloadsweekly downloads

4

version

2.0.0

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability