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

htmlnano

Package Overview
Dependencies
Maintainers
2
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

htmlnano

Modular HTML minifier, built on top of the PostHTML

  • 1.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
118K
decreased by-60.71%
Maintainers
2
Weekly downloads
 
Created

What is htmlnano?

htmlnano is a highly configurable HTML minifier that helps reduce the size of HTML files by removing unnecessary characters, comments, and whitespace. It also provides various optimization options to improve the performance of web pages.

What are htmlnano's main functionalities?

Minification

This feature removes unnecessary characters, comments, and whitespace from HTML files to reduce their size.

const htmlnano = require('htmlnano');
const html = '<!DOCTYPE html> <html> <head> <title>Test</title> </head> <body> <h1>Hello, world!</h1> </body> </html>';
htmlnano.process(html).then(result => console.log(result.html));

Attribute Optimization

This feature removes empty attributes from HTML tags to further reduce the file size.

const htmlnano = require('htmlnano');
const html = '<img src="image.jpg" alt="" />';
const options = { removeEmptyAttributes: true };
htmlnano.process(html, options).then(result => console.log(result.html));

CSS and JS Minification

This feature minifies inline CSS and JavaScript within HTML files to optimize performance.

const htmlnano = require('htmlnano');
const html = '<style>body { margin: 0; }</style><script>console.log("Hello, world!");</script>';
const options = { minifyCss: true, minifyJs: true };
htmlnano.process(html, options).then(result => console.log(result.html));

Removing Redundant Attributes

This feature removes redundant attributes from HTML tags to make the HTML cleaner and smaller.

const htmlnano = require('htmlnano');
const html = '<input type="text" disabled="disabled" />';
const options = { removeRedundantAttributes: true };
htmlnano.process(html, options).then(result => console.log(result.html));

Other packages similar to htmlnano

Keywords

FAQs

Package last updated on 19 Sep 2021

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