{"_id":"grunt-sri","_rev":"22-f559e48f36cc5a4d00790cec30345664","name":"grunt-sri","time":{"modified":"2022-06-18T16:01:32.266Z","created":"2015-02-25T10:16:55.607Z","0.0.0":"2015-02-25T10:16:55.607Z","0.0.1":"2015-02-25T10:17:19.503Z","0.0.2":"2015-03-05T22:18:21.124Z","0.0.3":"2015-03-08T08:14:06.639Z","0.0.4":"2015-03-09T01:36:56.329Z","0.0.5":"2015-03-10T02:29:09.107Z","0.1.0":"2016-12-09T08:00:09.245Z","0.2.0":"2016-12-16T08:29:11.284Z"},"maintainers":[{"email":"xhmikosr@gmail.com","name":"xhmikosr"},{"email":"francois@fmarier.org","name":"fmarier"},{"email":"neftaly.hernandez@gmail.com","name":"neftaly"}],"dist-tags":{"latest":"0.2.0"},"description":"Client-side caching & SRI generation for Grunt","readme":"# grunt-sri\n\n[![Build Status](https://travis-ci.org/neftaly/grunt-sri.svg?branch=master)](https://travis-ci.org/neftaly/grunt-sri)\n[![Dependencies Status](https://david-dm.org/neftaly/grunt-sri.svg)](https://david-dm.org/neftaly/grunt-sri)\n[![Dev Dependencies Status](https://david-dm.org/neftaly/grunt-sri/dev-status.svg)](https://david-dm.org/neftaly/grunt-sri#info=devDependencies)\n\nThis tool generates a JSON manifest of file hashes & [sub-resource integrity](https://srihash.org/) data.\n\n\n## Install\n\n```shell\nnpm install --save-dev grunt-sri\n```\n\n\n## Usage\n\nAdd the following to your `Gruntfile.js`:\n\n```js\nmodule.exports = function (grunt) {\n    \"use strict\";\n\n    grunt.loadNpmTasks(\"grunt-sri\");\n\n    grunt.initConfig({\n        \"sri\": {\n\n            // Use the default settings for *everything* in ./public/css\n            \"bobsDefaultTask\": {\n                \"src\": [\n                    \"public/**/*.css\"\n                ]\n            },\n\n            // Create a second manifest with custom settings\n            \"janesCustomTask\": {\n                \"options\": {\n                    \"algorithms\": [\"sha256\"],\n                    \"dest\": \"./public/sri-directives.json\",\n                    \"targetProp\": \"payload\"\n                },\n                \"files\": [\n                    {\n                        src: \"public/css/example.css\",\n                        type: \"text/css\",\n                        id: \"cssfile1\"\n                    },\n                    {\n                        src: \"public/css/other.css\"\n                    }\n                ]\n            }\n\n        }\n\n    });\n\n    grunt.registerTask(\"default\", [\"sri\"]);\n};\n```\n\nRun the command `grunt`. The manifest file will be created.\n\n\n## Options\n\n* String **dest**: Target JSON file.  \n  Default `\"./payload.json\"`\n* Boolean **merge**: Merge results with existing JSON file.  \n  Default `false` (overwrite)\n* Array **algorithms**: List of desired hash algorithms.  \n  Default `[\"sha256\", \"sha512\"]`\n* String **targetProp**: Target JS object property name.  \n  Default `null`\n* Boolean **pretty**: Stringify the JSON output in a pretty format.  \n  Default `false`\n\n\n## Manifest\n\nMetadata is stored in JSON format.\n\n* The default manifest dest is `./payload.json`.\n* File paths are relative to the CWD of Grunt.  \n  This should be the project root.\n* File identifiers are prefixed with the \"@\" symbol.  \n  If no ID is specified, the path will be used.\n\nExample:\n\n```json\n{\n    \"@cssfile1\": {\n        \"path\": \"public/css/example.css\",\n        \"type\": \"text/css\",\n        \"integrity\": \"type:text/css sha256-XXXX sha512-XXXXXXXX\",\n        \"hashes\": {\n            \"sha256\": \"XXXX\",\n            \"sha512\": \"XXXXXXXX\"\n        }\n    }\n}\n```\n\n### Implementation\n\nData from the manifest can be loaded into markup.\nUse the `integrity` property for SRI integrity attributes, a hash from `hashes` as a URL parameter for client-side caching, etc.\n\n#### PHP\n\n```php\n// In production, consider compiling JSON to PHP assoc arrays\n$payload = json_decode(file_get_contents(\"./payload.json\"), true);\n$sri = function (id) {\n    return $payload[\"payload\"][id];\n}\n\n$element = \"<link\n    href='/style.css?cache={ sri(\"@cssfile1\")[\"hashes\"][\"sha256\"] }'\n    integrity='{ $sri(\"@cssfile1\")[\"integrity\"] }'\n    rel='stylesheet'>\";\n```\n\n#### JavaScript\n\n**Note:** Node apps should use [subresource](https://github.com/neftaly/npm-subresource) or [handlebars-helper-sri](https://github.com/neftaly/handlebars-helper-sri), which don't require a build step.\n\n```js\n// ES6\nvar payload = require(\"./payload.json\");\nvar sri = (id) => payload.payload[id];\n\nvar element = `<link\n    href='/style.css?cache=${ sri(\"@cssfile1\").hashes.sha256 }'\n    integrity='${ sri(\"@cssfile1\").integrity }'\n    rel='stylesheet'>`;\n```\n\n\n## SemVer\n\nThis tool follows SemVer from v0.1.0, as [SRI is now a W3C recommendation](https://www.w3.org/TR/SRI/).\n\nChanges to the V1 SRI spec will be tracked with minor releases.\n","versions":{"0.0.2":{"name":"grunt-sri","version":"0.0.2","description":"Client-side caching & SRI generation for Grunt","author":{"name":"Neftaly Hernandez","email":"neftaly.hernandez@gmail.com"},"license":"MIT","repository":{"type":"git","url":"https://github.com/neftaly/grunt-sri.git"},"keywords":["gruntplugin","caching","cache","busting","buster","SRI","subresource","sub-resource","integrity","security","hash","digest","file"],"main":"main","scripts":{"test":"grunt test"},"dependencies":{"sri-toolbox":"^0.1.3"},"devDependencies":{"grunt":"^0.4.5","grunt-cli":"^0.1.13","grunt-jslint":"^1.1.12","grunt-mocha-test":"^0.12.7","mocha":"^2.1.0"},"peerDependencies":{"grunt":">=0.4.0"},"files":["tasks"],"engines":{"node":">=0.10.0"},"gitHead":"eaad83bc840e2528dee0874e6bf36139ae0007e3","bugs":{"url":"https://github.com/neftaly/grunt-sri/issues"},"homepage":"https://github.com/neftaly/grunt-sri","_id":"grunt-sri@0.0.2","_shasum":"f9c8ec985ae0eeb23b294cac3fb24c975e3b470a","_from":".","_npmVersion":"2.6.1","_nodeVersion":"0.10.36","_npmUser":{"name":"neftaly","email":"neftaly.hernandez@gmail.com"},"maintainers":[{"name":"neftaly","email":"neftaly.hernandez@gmail.com"}],"dist":{"shasum":"f9c8ec985ae0eeb23b294cac3fb24c975e3b470a","tarball":"https://registry.npmjs.org/grunt-sri/-/grunt-sri-0.0.2.tgz","integrity":"sha512-pdA10wYLHNTKGkxdvZC7STT+SjrYYKedPYtMe8bGctNDo2pE+olZgxsbQxEoz+4S68Wyap6acrEZD9Uhkegwew==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIG/E7sCDtW2l3s3T+J5Bm8mqUtINQf6kunXcw/+/hBgCAiAjxh0eSc1/QkbnoGcR1BV2+EZufyyM0ILM360c7nO5nA=="}]}},"0.0.3":{"name":"grunt-sri","version":"0.0.3","description":"Client-side caching & SRI generation for Grunt","author":{"name":"Neftaly Hernandez","email":"neftaly.hernandez@gmail.com"},"license":"MIT","repository":{"type":"git","url":"https://github.com/neftaly/grunt-sri.git"},"keywords":["gruntplugin","caching","cache","busting","buster","SRI","subresource","sub-resource","integrity","security","hash","digest","file"],"main":"main","scripts":{"test":"grunt test"},"dependencies":{"async":"^0.9.0","sri-toolbox":"^0.1.3"},"devDependencies":{"grunt":"^0.4.5","grunt-cli":"^0.1.13","grunt-jslint":"^1.1.12","grunt-mocha-test":"^0.12.7","mocha":"^2.1.0"},"peerDependencies":{"grunt":">=0.4.0"},"files":["tasks"],"engines":{"node":">=0.10.0"},"gitHead":"b5a95de1722364734cf09048db85a798982afb9e","bugs":{"url":"https://github.com/neftaly/grunt-sri/issues"},"homepage":"https://github.com/neftaly/grunt-sri","_id":"grunt-sri@0.0.3","_shasum":"e798425fe230f1a79e52c91ea3a73ecf5c183aed","_from":".","_npmVersion":"1.4.28","_npmUser":{"name":"neftaly","email":"neftaly.hernandez@gmail.com"},"maintainers":[{"name":"neftaly","email":"neftaly.hernandez@gmail.com"}],"dist":{"shasum":"e798425fe230f1a79e52c91ea3a73ecf5c183aed","tarball":"https://registry.npmjs.org/grunt-sri/-/grunt-sri-0.0.3.tgz","integrity":"sha512-id2bAOKVHqlYCAVuQScM4/wtEQhwMKtlhhzKgST0cRgxYK4pxR/6zlt6CCStBILHZjhys3QgumnOc40wOVglWQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC9/crhLndZ1239FpmpE6isVboD3L0BhJg/82IJYw3i1gIgFRlcVI196scoALGJYgCkqdXqfhpYJB6FP1SMHiPPiWI="}]}},"0.0.4":{"name":"grunt-sri","version":"0.0.4","description":"Client-side caching & SRI generation for Grunt","author":{"name":"Neftaly Hernandez","email":"neftaly.hernandez@gmail.com"},"license":"MIT","repository":{"type":"git","url":"https://github.com/neftaly/grunt-sri.git"},"keywords":["gruntplugin","caching","cache","busting","buster","SRI","subresource","sub-resource","integrity","security","hash","digest","file"],"main":"main","scripts":{"test":"grunt test"},"dependencies":{"async":"^0.9.0","curry":"^1.2.0","sri-toolbox":"^0.1.3"},"devDependencies":{"grunt":"^0.4.5","grunt-cli":"^0.1.13","grunt-jslint":"^1.1.12","grunt-mocha-test":"^0.12.7","mocha":"^2.1.0"},"peerDependencies":{"grunt":">=0.4.0"},"files":["tasks"],"engines":{"node":">=0.10.0"},"gitHead":"56bf1df65c2c330d6054c5ed2e690afd2de0b4a5","bugs":{"url":"https://github.com/neftaly/grunt-sri/issues"},"homepage":"https://github.com/neftaly/grunt-sri","_id":"grunt-sri@0.0.4","_shasum":"32cb13b95e719d19497e16f2ca0f3689ea2e1973","_from":".","_npmVersion":"2.6.1","_nodeVersion":"0.10.36","_npmUser":{"name":"neftaly","email":"neftaly.hernandez@gmail.com"},"maintainers":[{"name":"neftaly","email":"neftaly.hernandez@gmail.com"}],"dist":{"shasum":"32cb13b95e719d19497e16f2ca0f3689ea2e1973","tarball":"https://registry.npmjs.org/grunt-sri/-/grunt-sri-0.0.4.tgz","integrity":"sha512-YElVe8PgLRnhwyvAO5SrRnaqYOu8rDddZpoUki0vK9cGsRO9PPQq+w+Dh4YbPYH7dK9lo0tO0Vu8dYR+s2DMZA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCn2VGA6GmmWvx+hWJiKCLzEVuspJTarcQe9u0rCw0kpAIge2DwYBlMk6wo9Fytl5vEb0glHDa9ftUDN0miHDj4qrc="}]}},"0.0.5":{"name":"grunt-sri","version":"0.0.5","description":"Client-side caching & SRI generation for Grunt","author":{"name":"Neftaly Hernandez","email":"neftaly.hernandez@gmail.com"},"license":"MIT","repository":{"type":"git","url":"https://github.com/neftaly/grunt-sri.git"},"keywords":["gruntplugin","caching","cache","busting","buster","SRI","subresource","sub-resource","integrity","security","hash","digest","file"],"main":"main","scripts":{"test":"grunt test"},"dependencies":{"async":"^0.9.0","ramda":"^0.11.0","sri-toolbox":"^0.1.3"},"devDependencies":{"grunt":"^0.4.5","grunt-cli":"^0.1.13","grunt-jslint":"^1.1.12","grunt-mocha-test":"^0.12.7","mocha":"^2.1.0"},"peerDependencies":{"grunt":">=0.4.0"},"files":["tasks"],"engines":{"node":">=0.10.0"},"gitHead":"d581552678e1ec574fea560b12fbf53dc29ea946","bugs":{"url":"https://github.com/neftaly/grunt-sri/issues"},"homepage":"https://github.com/neftaly/grunt-sri","_id":"grunt-sri@0.0.5","_shasum":"0c459e592f2f625ad4c0ea727db44fb67ab0e2e9","_from":".","_npmVersion":"2.6.1","_nodeVersion":"0.10.36","_npmUser":{"name":"neftaly","email":"neftaly.hernandez@gmail.com"},"maintainers":[{"name":"neftaly","email":"neftaly.hernandez@gmail.com"}],"dist":{"shasum":"0c459e592f2f625ad4c0ea727db44fb67ab0e2e9","tarball":"https://registry.npmjs.org/grunt-sri/-/grunt-sri-0.0.5.tgz","integrity":"sha512-84rMJ2wl1mgcCiCE4jccInvtdUp/FOFYZnXeMUmx1EUZLSb3EXONeeWIF5SXuYTwiUFgp8A27u/afJeudetYvg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDYds57XrDDmaEdHhXMwLo4DvA0FzwK34XA10dJ8aLFpQIgM3lilql/JQlZBkCZ4hm3akfVUJSEZLjB+Hsg6zJJp3Q="}]}},"0.1.0":{"name":"grunt-sri","version":"0.1.0","description":"Client-side caching & SRI generation for Grunt","author":{"name":"Neftaly Hernandez","email":"neftaly.hernandez@gmail.com"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/neftaly/grunt-sri.git"},"bugs":{"url":"https://github.com/neftaly/grunt-sri/issues"},"homepage":"https://github.com/neftaly/grunt-sri#readme","keywords":["gruntplugin","caching","cache","busting","buster","SRI","subresource","sub-resource","integrity","security","hash","digest","file"],"main":"tasks/sri.js","scripts":{"test":"grunt test"},"dependencies":{"async":"^2.0.0","ramda":"^0.22.1","sri-toolbox":"^0.2.0"},"devDependencies":{"grunt":"^1.0.1","grunt-contrib-jshint":"^1.0.0","grunt-mocha-test":"^0.13.2","mocha":"^3.1.1"},"peerDependencies":{"grunt":">=0.4.0"},"files":["tasks"],"engines":{"node":">=0.10.0"},"gitHead":"578d86998d2506836b97f3c817c7ed0ed8a9d15a","_id":"grunt-sri@0.1.0","_shasum":"a618100b1546665835f59d47e29438b3132ac0dc","_from":".","_npmVersion":"3.10.9","_nodeVersion":"6.9.2","_npmUser":{"name":"xhmikosr","email":"xhmikosr@gmail.com"},"dist":{"shasum":"a618100b1546665835f59d47e29438b3132ac0dc","tarball":"https://registry.npmjs.org/grunt-sri/-/grunt-sri-0.1.0.tgz","integrity":"sha512-o6P3WsIM+XZ77qGv9FG5YbWLa19/j9qjkQJGoNZSdyadfz8SRehIzHv5+52417JOuE86/49gWsmbfHI9jaZlsQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCc5ckNzblzvNAYIKGszeZFYiO8ilQ4YDePeZWsslg3ngIgZb4LPPLxofpYLhtpbQ/VOWVdggiNueYDri0++Y7zTEM="}]},"maintainers":[{"name":"fmarier","email":"francois@fmarier.org"},{"name":"neftaly","email":"neftaly.hernandez@gmail.com"},{"name":"xhmikosr","email":"xhmikosr@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/grunt-sri-0.1.0.tgz_1481270407145_0.05098106828518212"}},"0.2.0":{"name":"grunt-sri","version":"0.2.0","description":"Client-side caching & SRI generation for Grunt","author":{"name":"Neftaly Hernandez","email":"neftaly.hernandez@gmail.com"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/neftaly/grunt-sri.git"},"bugs":{"url":"https://github.com/neftaly/grunt-sri/issues"},"homepage":"https://github.com/neftaly/grunt-sri#readme","keywords":["gruntplugin","caching","cache","busting","buster","SRI","subresource","sub-resource","integrity","security","hash","digest","file"],"main":"tasks/sri.js","scripts":{"test":"grunt test"},"dependencies":{"async":"^2.0.0","ramda":"^0.22.1","sri-toolbox":"^0.2.0"},"devDependencies":{"grunt":"^1.0.1","grunt-contrib-jshint":"^1.0.0","grunt-mocha-test":"^0.13.2","mocha":"^3.1.1"},"peerDependencies":{"grunt":">=0.4.0"},"files":["tasks"],"engines":{"node":">=0.10.0"},"gitHead":"b22535abaf4ea247c57d014b26092af07aa205cc","_id":"grunt-sri@0.2.0","_shasum":"ff647314b513b69392527190b7697d0ecc747958","_from":".","_npmVersion":"3.10.9","_nodeVersion":"6.9.2","_npmUser":{"name":"xhmikosr","email":"xhmikosr@gmail.com"},"dist":{"shasum":"ff647314b513b69392527190b7697d0ecc747958","tarball":"https://registry.npmjs.org/grunt-sri/-/grunt-sri-0.2.0.tgz","integrity":"sha512-DG1034e5neULWgkCaiqdsyfRNztdOTPNVIOUw+eFOLozbZZaaDnOAz7JiHi7lufYFlobPSuWnH4HnlOT+NlAIg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC+2GOoYTKZLo0ImggnhKOG3j52P2OsHRAHRMSlzHHyBAIhAIbQfm20rKLhpLwSyFgk7ZlGNKcqnL7l8Wwx0pggg/2i"}]},"maintainers":[{"name":"fmarier","email":"francois@fmarier.org"},{"name":"neftaly","email":"neftaly.hernandez@gmail.com"},{"name":"xhmikosr","email":"xhmikosr@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/grunt-sri-0.2.0.tgz_1481876949563_0.5394963819999248"}}},"homepage":"https://github.com/neftaly/grunt-sri#readme","keywords":["gruntplugin","caching","cache","busting","buster","SRI","subresource","sub-resource","integrity","security","hash","digest","file"],"repository":{"type":"git","url":"git+https://github.com/neftaly/grunt-sri.git"},"author":{"name":"Neftaly Hernandez","email":"neftaly.hernandez@gmail.com"},"bugs":{"url":"https://github.com/neftaly/grunt-sri/issues"},"license":"MIT","readmeFilename":"README.md"}