🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more

esbuild-plugin-minify-html

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
e

esbuild-plugin-minify-html

esbuild plugin for importing html files as minified raw text.

0.1.2
latest
Version published
Maintainers
1
Created

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.

FAQs

Package last updated on 24 Mar 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts