{"id":17963029,"url":"https://github.com/sparanoid/grunt-sri-hash","last_synced_at":"2025-04-03T19:21:51.794Z","repository":{"id":55151944,"uuid":"145436826","full_name":"sparanoid/grunt-sri-hash","owner":"sparanoid","description":"A grunt task which hashes all inlined scripts and stylesheets with integrity attributes.","archived":false,"fork":false,"pushed_at":"2025-01-23T22:40:48.000Z","size":381,"stargazers_count":1,"open_issues_count":6,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-11T14:57:16.249Z","etag":null,"topics":["grunt","grunt-plugins","sri","sri-hash"],"latest_commit_sha":null,"homepage":null,"language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sparanoid.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-08-20T15:35:44.000Z","updated_at":"2019-05-04T14:16:21.000Z","dependencies_parsed_at":"2024-06-21T13:08:47.058Z","dependency_job_id":"c16ea885-b818-4a8a-8e44-f49094602510","html_url":"https://github.com/sparanoid/grunt-sri-hash","commit_stats":{"total_commits":39,"total_committers":3,"mean_commits":13.0,"dds":0.2564102564102564,"last_synced_commit":"e414f962ffca0db9f41f269b807bd92f934592f9"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sparanoid%2Fgrunt-sri-hash","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sparanoid%2Fgrunt-sri-hash/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sparanoid%2Fgrunt-sri-hash/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sparanoid%2Fgrunt-sri-hash/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sparanoid","download_url":"https://codeload.github.com/sparanoid/grunt-sri-hash/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247061991,"owners_count":20877194,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["grunt","grunt-plugins","sri","sri-hash"],"created_at":"2024-10-29T11:22:56.816Z","updated_at":"2025-04-03T19:21:51.771Z","avatar_url":"https://github.com/sparanoid.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# grunt-sri-hash\n[![Greenkeeper badge](https://badges.greenkeeper.io/sparanoid/grunt-sri-hash.svg)](https://greenkeeper.io/)\n[![Build Status](https://api.travis-ci.org/sparanoid/grunt-sri-hash.svg?branch=master)](https://travis-ci.org/sparanoid/grunt-sri-hash)\n[![Dependency Status](https://david-dm.org/sparanoid/grunt-sri-hash.svg)](https://david-dm.org/sparanoid/grunt-sri-hash)\n[![devDependency Status](https://david-dm.org/sparanoid/grunt-sri-hash/dev-status.svg)](https://david-dm.org/sparanoid/grunt-sri-hash#info=devDependencies)\n[![npm Version](https://img.shields.io/npm/v/grunt-sri-hash.svg)](https://www.npmjs.com/package/grunt-sri-hash)\n[![npm Downloads](https://img.shields.io/npm/dm/grunt-sri-hash.svg)](https://www.npmjs.com/package/grunt-sri-hash)\n\n\u003e A grunt task which hashes all scripts and stylesheets with integrity attributes.\n\n## Getting Started\n\nIf you haven't used [Grunt](http://gruntjs.com/) before, be sure to check out the [Getting Started](http://gruntjs.com/getting-started) guide, as it explains how to create a [Gruntfile](http://gruntjs.com/sample-gruntfile) as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:\n\n```shell\nnpm install grunt-sri-hash --save-dev\n```\n\nOne the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:\n\n```js\ngrunt.loadNpmTasks('grunt-sri-hash');\n```\n\n## The \"sri_hash\" task\n\n### Overview\n\nIn your project's Gruntfile, add a section named `sri_hash` to the data object passed into `grunt.initConfig()`.\n\n```js\ngrunt.initConfig({\n  sri_hash: {\n    options: {\n      algorithm: \"sha512\",\n      selector: 'script[src]:not([integrity]):not([src^=\"http\"]):not([src^=\"//\"])'\n    },\n    all: {\n      files: {\n        'dest-index.html': 'source-index.html',\n      },\n    },\n  },\n});\n```\n\n### Options\n\n#### `algorithm`\n\nDefaults to `sha384`.\n\n```js\n\ngrunt.initConfig({\n  sri_hash: {\n    all: {\n      options: {\n        algorithm: 'sha384'\n      },\n      files: {\n        'dest-index.html': 'source-index.html',\n      },\n    },\n  },\n});\n```\n\n#### `selector`\n\nDefaults to `link[rel=stylesheet][href]:not([integrity]):not([href^=\"http\"]):not([href^=\"//\"]), script[src]:not([integrity]):not([src^=\"http\"]):not([src^=\"//\"])`.\n\n```js\n\ngrunt.initConfig({\n  sri_hash: {\n    all: {\n      options: {\n        selector: 'script[src]:not([integrity]):not([src^=\"http\"]):not([src^=\"//\"])'\n      },\n      files: {\n        'dest-index.html': 'source-index.html',\n      },\n    },\n  },\n});\n```\n\n#### `assetsDir`\n\nDefaults to `''`.\n\n```js\n\ngrunt.initConfig({\n  sri_hash: {\n    all: {\n      options: {\n        assetsDir: '_site'\n      },\n      files: {\n        'dest-index.html': 'source-index.html',\n      },\n    },\n  },\n});\n```\n\n## Contributing\n\nIn lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using [Grunt](http://gruntjs.com/).\n\n## Release History\n\n- See `CHANGELOG.md` for release history\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsparanoid%2Fgrunt-sri-hash","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsparanoid%2Fgrunt-sri-hash","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsparanoid%2Fgrunt-sri-hash/lists"}