Go to file
Wilson Lin ba03841945 Complete refactoring; move CLI to separate project 2019-04-30 00:09:51 +10:00
ext Update rules to use new nicehash; complete refactor of units attr, attr/unquoted, attr/quoted, entity, and tag/name; improve cfg usage 2019-04-21 02:40:25 +10:00
lib Incomplete major refactoring 2019-01-25 21:25:10 +13:00
notes Demo of jmp 2019-01-26 14:14:48 +11:00
src/hb Complete refactoring; move CLI to separate project 2019-04-30 00:09:51 +10:00
test Complete refactoring; move CLI to separate project 2019-04-30 00:09:51 +10:00
.clang-format Update rules to use new nicehash; complete refactor of units attr, attr/unquoted, attr/quoted, entity, and tag/name; improve cfg usage 2019-04-21 02:40:25 +10:00
.gitignore Begin restructuring 2019-03-18 22:46:04 +11:00
.gitmodules Use nicehash 2018-07-02 21:21:35 +12:00
CMakeLists.txt Complete refactoring; move CLI to separate project 2019-04-30 00:09:51 +10:00
Doxyfile Update rules to use new nicehash; complete refactor of units attr, attr/unquoted, attr/quoted, entity, and tag/name; improve cfg usage 2019-04-21 02:40:25 +10:00
LICENSE Initial commit 2018-06-30 22:37:24 +12:00
README.md Complete refactoring; move CLI to separate project 2019-04-30 00:09:51 +10:00
preprocess.sh Handle errors gracefully by unwinding stack; implement Emscripten version 2018-08-22 03:02:14 +12:00
test.sh Complete refactoring; move CLI to separate project 2019-04-30 00:09:51 +10:00

README.md

hyperbuild

A fast one-pass in-place HTML minifier written in C with advanced whitespace handling.

Currently in beta, working on documentation and tests. Issues and pull requests welcome!

Features

  • Minification is done in one pass with no backtracking or DOM/AST building.
  • No dynamic memory is allocated during processing, which increases safety and performance.
  • Advanced whitespace handling options allow maximum minification while retaining valid spaces.

Usage

This is the library. To use hyperbuild, you'll probably need one of these:

Documentation for the library itself is currently WIP.

hyperbuild uses the following dependencies, which are included as submodules:

Minification

Guide below is currently WIP.

Whitespace

hyperbuild has advanced whitespace minification that can allow strategies such as:

  • leave whitespace untouched in pre and code, which are whitespace sensitive
  • trim and collapse whitespace in content tags, as whitespace is collapsed anyway when rendered
  • remove whitespace in layout tags, which allows the use of inline layouts while keeping formatted code

Beginning and end

<p>↵
··The·quick·brown·fox↵
</p>

Between text and tags

<p>The·quick·brown·fox·<strong>jumps</strong>·over·the·lazy·dog.</p>

Contiguous

<select>↵
··<option>Jan:·········1</option>↵
··<option>Feb:········10</option>↵
··<option>Mar:·······100</option>↵
··<option>Apr:······1000</option>↵
··<option>May:·····10000</option>↵
··<option>Jun:····100000</option></select>

Whole text

<p>↵
···↵
</p>

Tag classification

Type Content
Formatting tags Text nodes
Content tags Formatting tags, text nodes
Layout tags Layout tags, content tags
Content-first tags Content of content tags or layout tags (but not both)

Specific tags

Tags not in one of the categories below are specific tags.

Formatting tags

<strong> moat </strong>

Content tags

<p>Some <strong>content</strong></p>

Content-first tags

<li>Anthony</li>
<li>
  <div>
  </div>
</li>

Layout tags

<div>
  <div></div>
</div>

Development

Currently, hyperbuild has a few limitations:

  • Only UTF-8 is supported.
  • Not aware of exotic Unicode whitespace characters.
  • Follows HTML5 only.
  • Only works on Linux.

Patches to change any of these welcome!