1.0.0 • Published 7 years ago

cachebusted v1.0.0

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

Standard Readme

Contributor Covenant Uses editorconfig JS written in Standard style Licensed under MIT

Map artifact names to cachebusted names

A manifest file is a JSON file that maps the name of an artifact to the path you can actually find it at. This is an important feature when you use cachebusting. This library helps you read and write these files.

Table of Contents

Install

This project uses node and npm. Go check them out if you don't have them locally installed.

$ npm install cachebusted

Usage

Initialize a new manifest file like this (the file doesn't need to exist yet):

let manifest = new Manifest({
  path: '/path/to/a/manifest.json'
})

You can read from the file like this:

manifest.translate('index.js').then((val) => {
  // val is now the cachebusted version of index.js
  console.log(val)
}).catch((err) => {
  // Don't forget to handle errors
})

You can now add entries to the file like this:

writeManifest.add({ 'frontend.js': 'frontend-123.js' }).then(() => {
  // Do what you need to do next
}).catch((err) => {
  // Don't forget to handle errors
})

Contribute

Bug reports and pull requests are welcome on GitHub at https://github.com/moonglum/cachebusted. You can find more information about contributing in the CONTRIBUTING.md. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The package is available as open source under the terms of the MIT License.