0.1.1 • Published 10 months ago

esbuild-plugin-minify-html v0.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

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.

0.1.1

10 months ago

0.1.0

10 months ago