From 4d9aac32bd59a2479846c36ec6a5be3130c43851 Mon Sep 17 00:00:00 2001 From: Adam Chalemian Date: Fri, 23 Sep 2016 14:29:33 -0400 Subject: [PATCH] #722: introduce `collapseCustomFragments` option to collapse white space around `ignoreCustomFragments` (default: false). --- README.md | 1 + cli.js | 1 + index.html | 9 +++++++++ src/htmlminifier.js | 2 +- tests/minifier.js | 11 +++++++++++ 5 files changed, 23 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index de74c98..7328c30 100644 --- a/README.md +++ b/README.md @@ -44,6 +44,7 @@ How does HTMLMinifier compare to other solutions — [HTML Minifier from Will Pe | `collapseBooleanAttributes` | [Omit attribute values from boolean attributes](http://perfectionkills.com/experimenting-with-html-minifier/#collapse_boolean_attributes) | `false` | | `collapseInlineTagWhitespace` | Don't leave any spaces between `display:inline;` elements when collapsing. Must be used in conjunction with `collapseWhitespace=true` | `false` | | `collapseWhitespace` | [Collapse white space that contributes to text nodes in a document tree](http://perfectionkills.com/experimenting-with-html-minifier/#collapse_whitespace) | `false` | +| `collapseCustomFragments` | Collapse white space around `ignoreCustomFragments`. | `false` | | `conservativeCollapse` | Always collapse to 1 space (never remove it entirely). Must be used in conjunction with `collapseWhitespace=true` | `false` | | `customAttrAssign` | Arrays of regex'es that allow to support custom attribute assign expressions (e.g. `'
'`) | `[ ]` | | `customAttrCollapse` | Regex that specifies custom attribute to strip newlines from (e.g. `/ng-class/`) | | diff --git a/cli.js b/cli.js index ab68d96..b30a5ac 100755 --- a/cli.js +++ b/cli.js @@ -101,6 +101,7 @@ var mainOptions = { collapseBooleanAttributes: 'Omit attribute values from boolean attributes', collapseInlineTagWhitespace: 'Collapse white space around inline tag', collapseWhitespace: 'Collapse white space that contributes to text nodes in a document tree.', + collapseCustomFragments: 'Collapse white space around ignoreCustomFragments.', conservativeCollapse: 'Always collapse to 1 space (never remove it entirely)', customAttrAssign: ['Arrays of regex\'es that allow to support custom attribute assign expressions (e.g. \'
\')', parseJSONRegExpArray], customAttrCollapse: ['Regex that specifies custom attribute to strip newlines from (e.g. /ng-class/)', parseRegExp], diff --git a/index.html b/index.html index 97f169e..e6c0722 100644 --- a/index.html +++ b/index.html @@ -57,6 +57,15 @@ Collapse white space that contributes to text nodes in a document tree +
  • + + + + Collapse white space around `ignoreCustomFragments. + +