| `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. `'<div flex?="{{mode != cover}}"></div>'`) | `[ ]` |
| `customAttrCollapse` | Regex that specifies custom attribute to strip newlines from (e.g. `/ng-class/`) | |
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. \'<div flex?="{{mode != cover}}"></div>\')', parseJSONRegExpArray],
customAttrCollapse: ['Regex that specifies custom attribute to strip newlines from (e.g. /ng-class/)', parseRegExp],
Collapse white space that contributes to text nodes in a document tree
</span>
</li>
+ <li>
+ <input type="checkbox" id="collapseCustomFragments" checked>
+ <label for="collapseCustomFragments">
+ Collapse custom fragment white space
+ </label>
+ <span class="quiet short">
+ Collapse white space around <code>`ignoreCustomFragments</code>.
+ </span>
+ </li>
<li>
<input type="checkbox" id="conservativeCollapse">
<label for="conservativeCollapse">
}
return collapseWhitespace(chunk, {
preserveLineBreaks: options.preserveLineBreaks,
- conservativeCollapse: true
+ conservativeCollapse: !options.collapseCustomFragments
}, /^\s/.test(chunk), /\s$/.test(chunk));
}
return chunk;
/\{\{.*?\}\}/g
]
}), output);
+
+ input = '<?php echo "foo"; ?> <span>bar</span>';
+ assert.equal(minify(input), input);
+ assert.equal(minify(input, {
+ collapseWhitespace: true
+ }), input);
+ output = '<?php echo "foo"; ?><span>bar</span>';
+ assert.equal(minify(input, {
+ collapseWhitespace: true,
+ collapseCustomFragments: true
+ }), output);
});
QUnit.test('bootstrap\'s span > button > span', function(assert) {