0.1.2 • Published 1 year ago

vite-tiptop-sri v0.1.2

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year 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

1 year ago

0.1.1

1 year ago

0.0.15

1 year ago

0.0.15-beta.1

1 year ago

0.0.14

1 year ago

0.0.13

1 year ago

0.0.12

1 year ago

0.0.11

1 year ago

0.0.10

1 year ago

0.0.9-beta.5

1 year ago

0.0.9-beta.4

1 year ago

0.0.9-beta.3

1 year ago

0.0.9-beta.2

1 year ago

0.0.9-beta.1

1 year ago

0.0.8

1 year ago

0.0.8-beta.3

1 year ago

0.0.8-beta.2

1 year ago

0.0.8-beta.1

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.5-beta.3

1 year ago

0.0.5-beta.2

1 year ago

0.0.5-beta.1

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago