Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
@types/html-minifier-terser
Advanced tools
TypeScript definitions for 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.
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);
gulp-htmlmin is a gulp plugin that minifies HTML. It wraps around html-minifier and provides a similar set of functionalities but is designed to be used in the gulp streaming build system. Compared to @types/html-minifier-terser, gulp-htmlmin is more specific to users of gulp.
webpack-html-plugin simplifies the creation of HTML files to serve your webpack bundles. While not a direct alternative for minifying HTML, it can be configured to use html-minifier-terser as part of its process, offering a more integrated approach in webpack-based projects.
npm install --save @types/html-minifier-terser
This package contains type definitions for html-minifier-terser (https://github.com/terser/html-minifier-terser#readme).
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/html-minifier-terser.
These definitions were written by Piotr Błażejewicz.
FAQs
TypeScript definitions for html-minifier-terser
The npm package @types/html-minifier-terser receives a total of 8,305,199 weekly downloads. As such, @types/html-minifier-terser popularity was classified as popular.
We found that @types/html-minifier-terser demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.