You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

esbuild-plugin-minify-html

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

esbuild-plugin-minify-html

esbuild plugin for importing html files as minified raw text.

0.1.2
latest
Source
npmnpm
Version published
Weekly downloads
61
-65.54%
Maintainers
1
Weekly downloads
 
Created
Source

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.

Keywords

esbuild

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