0.1.2 • Published 2 years ago

vite-tiptop-sri v0.1.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

vite-tiptop-sri

Install

Run the following command:

npm i vite-tiptop-sri --save-dev

How to use

Make the following changes to vite.config.js:

import { defineConfig } from "vite";
import sri from "vite-tiptop-sri";

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

Then run the build command:

npm run build

And finally check the index.html file inside the dist/ folder.

You also have the possibility of subresource integrity in manifest assets.

import { defineConfig } from "vite";
import sri from "vite-tiptop-sri";

export default defineConfig({
  build: {
    manifest: true,
  },
  plugins: [sri({ augmentManifest: true })],
});

By default it will get the manifest.json, but others can be specified by taking into account the output directory.

import { defineConfig } from "vite";
import sri from "vite-tiptop-sri";

export default defineConfig({
  build: {
    manifest: true,
  },
  plugins: [
    sri({
      augmentManifest: true,
      manifestPaths: ["manifest.json", "manifest-assets.json"],
    }),
  ],
});

If you have a script that changes its content after the build process, you can ignore it as follows:

import { defineConfig } from "vite";
import sri from "vite-tiptop-sri";

export default defineConfig({
  build: {
    manifest: true,
  },
  plugins: [
    sri({
      augmentManifest: true,
      filesToIgnore: ["/environment.js"],
    }),
  ],
});

Credits

This package was inspired by the following projects:

License

MIT

0.1.2

2 years ago

0.1.1

2 years ago

0.0.15

2 years ago

0.0.15-beta.1

2 years ago

0.0.14

2 years ago

0.0.13

2 years ago

0.0.12

2 years ago

0.0.11

2 years ago

0.0.10

2 years ago

0.0.9-beta.5

2 years ago

0.0.9-beta.4

2 years ago

0.0.9-beta.3

2 years ago

0.0.9-beta.2

2 years ago

0.0.9-beta.1

2 years ago

0.0.8

2 years ago

0.0.8-beta.3

2 years ago

0.0.8-beta.2

2 years ago

0.0.8-beta.1

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5-beta.3

2 years ago

0.0.5-beta.2

2 years ago

0.0.5-beta.1

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago