@small-tech/vite-plugin-sri

1.0.1 • Public • Published

@small-tech/vite-plugin-sri

Subresource integrity (SRI) plugin for Vite.

Adds subresource integrity hashes to script and stylesheet imports from your index.html file at build time.

Install

npm i --save-dev @small-tech/vite-plugin-sri

Use

In your vite.config.js file:

import { defineConfig } from 'vite'
import sri from '@small-tech/vite-plugin-sri'

export default defineConfig({
  // …
  plugins: [sri()]
})

Then:

npx vite build

Test and coverage

Run npm test to test, npm run coverage to run coverage.

See also

If you’re looking for a generic Rollup plugin that does the same thing, see rollup-plugin-sri by Jonas Kruckenberg that this one was inspired by.

Like this? Fund us!

Small Technology Foundation is a tiny, independent not-for-profit.

We exist in part thanks to patronage by people like you. If you share our vision and want to support our work, please become a patron or donate to us today and help us continue to exist.

Copyright

Copyright © 2021-present Aral Balkan, Small Technology Foundation.

License

ISC.

Package Sidebar

Install

npm i @small-tech/vite-plugin-sri

Weekly Downloads

297

Version

1.0.1

License

ISC

Unpacked Size

6.07 kB

Total Files

5

Last publish

Collaborators

  • aral