Vite plugin that embeds .js and .css as base85 data
npm install @molgenis/vite-plugin-inline
Vite plugin that embeds .js and .css as gzipped base85 encoded data. Can be used together with
the provided loader to create a stand-alone .html that can be viewed offline in a web browser.
See https://github.com/molgenis/vip-report-template for an example.
Update vite-config.ts as follows:
``js
import { defineConfig } from "vitest/config";
import inlinePlugin from "@molgenis/vite-plugin-inline/src/vite-plugin-inline.js";
export default defineConfig({
plugins: [inlinePlugin()],
esbuild: {
// @molgenis/vite-plugin-inline requires ascii input and cannot handle UTF-8 input
charset: "ascii",
},
build: {
rollupOptions: {
inputFilePath: ["./index.html", "@molgenis/vite-plugin-inline/src/loader.ts"],
outputFilePath: {
manualChunks: undefined,
},
},
},
});
`
Change ./index.html if your .html path differs.
Execute npm run build to build a stand-alone .html.
`html``