Package Exports
- hashlink
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (hashlink) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Overview
Hashlink is a command line tool that generates symbolic links for files matching the provided pattern, using the file contents to generate hashes for the link names.
It outputs a manifest JSON which maps the original filepaths to the links. This can be used to implement file revving, so that new versions of files are always downloaded in favour of old, cached versions.
Install
npm install hashlinkUsage
Command line
Run hashlink --help for usage.
Running hashlink '*.js' will create a symbolic link of all JS files in the current directory. A map is printed to stdout - it may look like this:
{
"main.js": "main-36442f185c.js",
"another-file.js": "another-file-44367351fa.js"
}Below is a more typical use case:
hashlink -s --relative dist 'dist/**/*.+(js|css)' > manifest.jsonEnsure you quote the filepath patterns, or your terminal may expand them instead of the app.
Node
const hashlink = require('hashlink');
hashlink({
patterns: ['dist/**/*.+(js|css)'],
relative: 'dist'
})
.then((manifest) => { console.log(manifest) })
.catch(() => { console.error('Oh no...') })