esbuild-plugin-minify-html
TypeScript icon, indicating that this package has built-in type declarations

0.1.1 • Public • Published

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.

Package Sidebar

Install

npm i esbuild-plugin-minify-html

Weekly Downloads

19

Version

0.1.1

License

MIT

Unpacked Size

2.9 MB

Total Files

8

Last publish

Collaborators

  • hatemhosny