asset-uploader
Library for uploading web assets to Amazon S3 or Azure Storage to support a "Never expire" policy.
It uploads files in a directory, changing their name to a hashed version, and provides a JSON lookup file.
For example, a directory containing 1 file "/css/styles.css":
It will generate an md5 hash of the file, and upload it as "/css/styles.<hash>.css".
This will then be written to a manifest JSON file as:
{
"/css/styles.css": "/css/styles.d41d8cd98f00b204e9800998ecf8427e.css"
}
Later you can use the manifest file when generating HTML.
Usage
Uploading assets and generating a manifest.json
const AssetUploader = const provider = 'bucket-name'const assetUploader = provider assetUploader
Lookup assets when running in production
var resolver = './manifest.json'resolver// returns '/css/styles.d41d8cd98f00b204e9800998ecf8427e.css'