Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/jonathannen/parcel-plugin-subresource-integrity

Generates Subresource Integrity attributes for Parcel outputs
https://github.com/jonathannen/parcel-plugin-subresource-integrity

Last synced: 2 months ago
JSON representation

Generates Subresource Integrity attributes for Parcel outputs

Awesome Lists containing this project

README

        

# parcel-plugin-subresource-integrity

Adds [Subresource Integrity](https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity) attributes to any CSS and JS bundled files referenced from your [Parcel Bundler](https://parceljs.org/) entry HTML asset (index.html).

## Usage

No configuration is needed. Install the package using yarn or npm and build using Parcel.

The integrity attribute will be added to any asset referenced from a HTML parcel entry point. Specifically, the plugin scans the output HTML (typically your index.html) and inserts the integrity attribute on any link or script tags that reference local assets.

If you're using the publicURL option, the crossorigin="anonymous" attribute is also added.

Integrity attributes are only added in production (i.e. when running parcel build) as it tends to get out of sync easily in watch mode. By default, the SHA-384 hash algorithm will be used.