
Product
Socket for Jira Is Now Available
Socket for Jira lets teams turn alerts into Jira tickets with manual creation, automated ticketing rules, and two-way sync.
vite-plugin-html-sri
Advanced tools
A Vite plugin that enables Subresource Integrity (SRI) by adding integrity attributes to JavaScript and CSS assets
Subresource Integrity (SRI) is a security feature that helps ensure resources fetched by your website are delivered without unexpected manipulation. It uses integrity hashes that browsers verify before loading the resources.
Vite, by default, does not provide support for Subresource Integrity (SRI). This plugin automatically generates integrity hashes for both local and external assets by transforming the html files.
Install the package as a devDependency
yarn add vite-plugin-html-sri -D
❗ Note: Integrity hashes are only added to resources that do not already have an existing integrity attribute.
# vite.config.js
import { defineConfig } from 'vite';
import sri from 'vite-plugin-html-sri';
export default defineConfig({
plugins: [
sri(),
],
})
This plugin offers the following optional options:
# Choose which algorithm to use for creating integrity hashes
algorithm: 'sha256' | 'sha384' | 'sha512' # default is 'sha384'
# Enable or disable adding integrity hashes to external assets
external: boolean # default is true
If you find this project interesting or helpful, I'd love your support! Please consider giving it a star (⭐) and following me on GitHub.
I love coding and always have new ideas, so stay tuned—your support won’t be in vain!
FAQs
A Vite plugin that enables Subresource Integrity (SRI) by adding integrity attributes to JavaScript and CSS assets
We found that vite-plugin-html-sri demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket for Jira lets teams turn alerts into Jira tickets with manual creation, automated ticketing rules, and two-way sync.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.