Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@types/html-minifier-terser

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/html-minifier-terser

TypeScript definitions for html-minifier-terser

  • 7.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
10M
increased by5.1%
Maintainers
1
Weekly downloads
 
Created

What is @types/html-minifier-terser?

The @types/html-minifier-terser package provides TypeScript type definitions for the html-minifier-terser package, which is a tool to minify HTML files. These type definitions allow TypeScript developers to use html-minifier-terser in their projects with the benefits of TypeScript's static type checking. The main functionalities include minifying HTML, removing comments, collapsing whitespace, and more, all while preserving the validity of the HTML.

What are @types/html-minifier-terser's main functionalities?

Minifying HTML

This feature allows you to minify HTML content by removing unnecessary spaces, comments, and other unneeded parts to reduce the size of the files. The code sample demonstrates how to remove attribute quotes from a simple HTML string.

import { minify } from 'html-minifier-terser';

const result = minify('<p title="blah" id="moo">foo</p>', {
  removeAttributeQuotes: true
});
console.log(result);

Collapsing Whitespace

This feature collapses unnecessary whitespace within the HTML to further reduce the file size without affecting the structure. The code sample shows how to collapse whitespace around and within HTML tags.

import { minify } from 'html-minifier-terser';

const result = minify('   <div>    <p>Example</p>    </div>   ', {
  collapseWhitespace: true
});
console.log(result);

Removing Comments

This functionality allows the removal of HTML comments from the file, which can be particularly useful for removing development notes and reducing file size. The code sample demonstrates removing a comment from an HTML string.

import { minify } from 'html-minifier-terser';

const result = minify('<!-- This is a comment --> <div>Content</div>', {
  removeComments: true
});
console.log(result);

Other packages similar to @types/html-minifier-terser

FAQs

Package last updated on 18 Oct 2023

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc