Socket
Socket
Sign inDemoInstall

@types/html-minifier-terser

Package Overview
Dependencies
0
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @types/html-minifier-terser

TypeScript definitions for html-minifier-terser


Version published
Weekly downloads
10M
increased by0.42%
Maintainers
1
Install size
9.45 kB
Created
Weekly downloads
 

Package description

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

Readme

Source

Installation

npm install --save @types/html-minifier-terser

Summary

This package contains type definitions for html-minifier-terser (https://github.com/terser/html-minifier-terser#readme).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/html-minifier-terser.

Additional Details

  • Last updated: Mon, 15 Aug 2022 21:02:37 GMT
  • Dependencies: none
  • Global values: none

Credits

These definitions were written by Piotr Błażejewicz.

FAQs

Last updated on 15 Aug 2022

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc