esbuild-plugin-minify-html
v0.1.1
Published
esbuild plugin for importing html files as minified raw text.
Downloads
254
Maintainers
Readme
esbuild-plugin-minify-html
esbuild plugin for importing html files as minified raw text.
It uses html-minifier-terser to minify the html.
Usage
// index.js
import appHTML from "./app.html?raw";
console.log(appHTML);
// build.js
import esbuild from "esbuild";
import minifyHTML from "esbuild-plugin-minify-html";
esbuild.build({
entryPoints: ["index.js"],
bundle: true,
outfile: "out.js",
plugins: [
minifyHTML({
// optional html-minifier-terser options
collapseWhitespace: true,
}),
],
});
With typescript
Add type declaration for *.html?raw
in your project.
declare module "*.html?raw" {
const src: string;
export default src;
}
Credit
This is a fork of esbuild-plugin-raw-css.