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

unreadable

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

unreadable

An intelligent/CSS-aware HTML Minifier and Optimizer

  • 0.0.15
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
Maintainers
1
Weekly downloads
 
Created
Source

CSS-Aware HTML Minifier

Aggressively removes whitespace from HTML; while taking into account each element's CSS properties to ensure the layout of the file is unchanged.

Inline JavaScript and CSS are minified using UglifyJS and clean-css respectively.

Please note Unreadable is a young project so there are still some issues and TODOs.

$ unreadable --inspect --url http://www.youtube.com --output youtube.min.html
✔ 12643 characters removed, 986/986 elements with layout unaffected by minification

Usage

-h, --help           output usage information
-V, --version        output the version number
-u --url [value]     URL to process
-i --inspect         Inspect layout before and after, to verify no elements have changed size or position (slower)
-o --output [value]  File to write minified source to
-c --config [value]  Path to JSON configuration file (see https://github.com/JamieMason/Unreadable#config)

Installation

npm install -g unreadable

You'll need to Download & Install PhantomJS.

Configuration

You can override any of Unreadable's defaults by providing a path to a JSON file.

unreadable --url http://... --config path/to/my/unreadable.json

Only the values you want to override need be defined, so to enable removal of optional closing tags for example - your file would look like this;

{
  "unreadable": {
    "remove_optional_closing_tags": true
  }
}

Defaults

All default values can be found in defaults.json, but here are the key ones;

  • remove_optional_closing_tags (false)

Some element's closing tags can be omitted, resulting in a much smaller file. But, doing so can affect layout (http://jsfiddle.net/csswizardry/UMYZs/) so this is disabled by default.

  • .optional_closing_tags (String[])

Omitting these element's closing tags is permitted, add/remove any you want to include/exclude as preferred.

  • .forbidden_closing_tags (String[])

These elements don't have closing tags, such as <img src="nevergonna.png"></img>.

  • .uglify_js.* (Object)

These values are applied to UglifyJS and are documented at https://github.com/mishoo/UglifyJS

  • .uglify_js.inline_script (true)

Since we're Uglifying JavaScript found in <script> blocks as opposed to external files, I wouldn't recommend changing this value.

Keywords

FAQs

Package last updated on 19 Dec 2012

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