Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ovhemert/gatsby-plugin-sri

Gatsby plugin for enabling Sub Resource Integrity
https://github.com/ovhemert/gatsby-plugin-sri

gatsby hash integrity plugin sri subresource

Last synced: 30 days ago
JSON representation

Gatsby plugin for enabling Sub Resource Integrity

Awesome Lists containing this project

README

        

# gatsby-plugin-sri

[![Travis](https://img.shields.io/travis/com/ovhemert/gatsby-plugin-sri.svg?branch=master&logo=travis)](https://travis-ci.com/ovhemert/gatsby-plugin-sri)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/3216215565884e7d9f4d5f298a0288a8)](https://www.codacy.com/app/ovhemert/gatsby-plugin-sri?utm_source=github.com&utm_medium=referral&utm_content=ovhemert/gatsby-plugin-sri&utm_campaign=Badge_Grade)
[![Known Vulnerabilities](https://snyk.io/test/npm/gatsby-plugin-sri/badge.svg)](https://snyk.io/test/npm/gatsby-plugin-sri)
[![Coverage Status](https://coveralls.io/repos/github/ovhemert/gatsby-plugin-sri/badge.svg)](https://coveralls.io/github/ovhemert/gatsby-plugin-sri)
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](http://standardjs.com/)

A Gatsby plugin to add Subresource Integrity (SRI) to your generated script tags.

```html

```
becomes
```html

```

## Installation

With npm:

```bash
npm install --save gatsby-plugin-sri
```

Or with Yarn:

```bash
yarn add gatsby-plugin-sri
```

## Usage

In your `gatsby-config.js` file add:

```javascript
module.exports = {
plugins: [
{
resolve: 'gatsby-plugin-sri',
options: {
hash: 'sha512', // 'sha256', 'sha384' or 'sha512' ('sha512' = default)
crossorigin: false // Optional
}
}
]
}
```

The `crossorigin` option, if set to `true`, will optionally add add a `crossorigin="anonymous"` attribute to the script / style tags.

## Maintainers

Osmond van Hemert
[![Github](https://img.shields.io/badge/-website.svg?style=social&logoColor=333&logo=github)](https://github.com/ovhemert)
[![Web](https://img.shields.io/badge/-website.svg?style=social&logoColor=333&logo=nextdoor)](https://ovhemert.dev)

## Contributing

If you would like to help out with some code, check the [details](./docs/CONTRIBUTING.md).

Not a coder, but still want to support? Have a look at the options available to [donate](https://ovhemert.dev/donate).

## Sponsors

[![BrowserStack](./docs/assets/browserstack-logo.svg)](https://www.browserstack.com/)

## License

Licensed under [MIT](./LICENSE).

_NOTE: This plugin only generates output when run in `production` mode! To test your generated tags, run: `gatsby build && gatsby serve`_