3.0.1 • Published 7 years ago
dbust v3.0.1
dbust
Pass it an object of hashed and original filenames and it saves them to a file. It will also delete the old file when the hash changes. Plugins for webpack and gulp-rev exist.
Intended usage
This package is intended to be used with gulp-dbust or webpack-dbust.
Direct usage
const dbust = require('dbust')
dbust.options(options)
// Add object of files to cache
// A cache is used to prevent multiple write to a manifest file in a short amount of time such as with gulp + webpack
dbust.put({
file1: 'file1-abc123',
file2: 'file2-xyz789',
})
// Write cache to file
dbust.save()
$ cat manifest.json
{"file1":"file1-abc123","file2":"file2-xyz789"}
Options
Defaults:
{
base: process.cwd(),
manifest: base + '/manifest.json',
}
base
Dirname of project. Defaults to process.cwd()
.
manifest
JSON file to store hashes in. Defaults to base/manifest.json
.
Upgrading to version 3.x.x
Settings are done a little differently:
require('dbust')(options) ➔ require('dbust'); dbust.options(options)
Version 3 only writes after all tasks are done to prevent weird stuff happening when two instances try to write the manifest at the same time.
dbust(files) ➔ dbust.put(files); dbust.save()
Testing
npm test