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

minimize

Package Overview
Dependencies
Maintainers
1
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

minimize

Minimize HTML

  • 0.0.7
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
35K
increased by21.09%
Maintainers
1
Weekly downloads
 
Created
Source

HTML minifier

Minimize is a HTML minifier based on the node-htmlparser. This depedency will ensure output is solid and correct. Currently, HTML minifier is only usuable server side. Client side minification will be added in a future release.

Features

Upcoming in release 2.0

  • minification of inline javascript by square
  • client side minification support
  • increased configurability (quote switcher, element replacement)

Usage

To get the minified content make sure to provide a callback. Optional an options object can be provided. All options are listed below and false per default.

var minimize = require('minimize')
  , options = {
        empty: true // DO NOT remove empty attributes 
      , cdata: true // DO NOT strip CDATA from scripts
      , comments: true // DO NOT remove comments
      , spare: true // DO NOT remove redundant attributes
    };

minimize(content, function (data) {
  console.log(data);
}, options);

Options

empty

cdata

comments

spare

Tests

Benchmarks

Credits

Minimize is influenced by the HTML minifier of kangax. This module parses the DOM as string as opposes to an object. However, retaining flow is more diffucult if the DOM is parsed sequentially. Minimize is not client-side ready. Kangax minifier also provides some additional options like linting. Minimize will retain strictly to the business of minifying.

HTMLparser of Tautologistics is used to create an object representation of the DOM.

Keywords

FAQs

Package last updated on 04 Mar 2013

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