@taped/vite-plugin-sri
v1.0.0
Published
A Vite plugin that adds subresource integrity hashes to your index.html file at build time.
Downloads
10
Maintainers
Readme
@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.
Build
Run npm run build
This will generate legacy CommonJS version of the module for compatibility with older Node projects.
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.