Generates Subresource Integrity (SRI) values for Local JavaScript and CSS resources, so you don’t have to regenerate them in the admin. Added in MMT 1.0.6. Run it from the root of a checkout (the folder that contains .mmt). File names are relative to that folder; on Windows use backslashes (templates\sfnt.mvt), because a path with forward slashes doesn’t match and is silently ignored.
Usage#
mmt sri [-2] [-3] [-5] [filepaths ...]
Arguments#
| Argument | Short | Required | Description |
|---|---|---|---|
--sha256 |
-2 |
No | Generate sha256 SRI. |
--sha384 |
-3 |
No | Generate sha384 SRI. |
--sha512 |
-5 |
No | Generate sha512 SRI. |
filepaths ... |
No | Local .js or .css files to generate values for. Defaults to every Local JS and CSS resource in the checkout. |
Examples#
Generate SHA-384 values for one file, then push them:
mmt sri -3 js/custom.js
mmt push -n "Update SRI for custom.js"
- With no algorithm flags, MMT uses all three and writes them as one value:
sha256-... sha384-... sha512-.... - It hashes your local
.jsor.cssfile as it is now. - It writes an
integrityattribute into the resource’s.json(for examplejs/custom.json), and acrossoriginattribute set toanonymousunless the resource already has one. - It doesn’t push. Run
mmt pushto send the updated.json, and the.jsor.cssif you changed it. - Only Local resources (
.jsand.cssfiles) can be used. Naming any other file givesMMT-COMMAND-SRI-00002.