Giter Site home page Giter Site logo

igogo5yo / vite5-plugin-sri Goto Github PK

View Code? Open in Web Editor NEW

This project forked from keita-hino/vite-plugin-sri2

0.0 0.0 0.0 385 KB

This plugin enhances the security of your project by adding Subresource Integrity (SRI) protection to the assets referenced in your 'index.html' file

Home Page: https://www.npmjs.com/package/vite-plugin-sri2

License: MIT License

Shell 0.37% JavaScript 26.94% TypeScript 53.35% CSS 15.93% HTML 3.42%

vite5-plugin-sri's Introduction

vite-plugin-sri2

Vite Plugin SRI2 adds Subresource Integrity (SRI) to the <script> and <link> elements in your "index.html" file during at build time.

Below are examples of how the <script> and <link> elements in your built "index.html" file would look like after SRI attributes have been added:
スクリーンショット 2023-08-22 8 58 51

Installation

$ yarn add vite-plugin-sri2 -D

# or

$ npm install vite-plugin-sri2 -D

# or

$ pnpm install vite-plugin-sri2 -D

Usage

add to vite config

// vite config
import { defineConfig } from 'vite';
import { sri } from 'vite-plugin-sri2';

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

Options

hashFunctionName

  • Type : string
  • Default : sha384

The supported hash functions are SHA-256, SHA-384, and SHA-512.
This is in compliance with the W3C specification.

Conformant user agents must support the SHA-256, SHA-384 and SHA-512 cryptographic hash functions for use as part of a request’s integrity metadata and may support additional hash functions.

The default is selected based on the W3C specification.

At the time of writing, SHA-384 is a good baseline.

License

MIT

vite5-plugin-sri's People

Contributors

keita-hino avatar github-actions[bot] avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.