-
Notifications
You must be signed in to change notification settings - Fork 584
#722: introduce collapseCustomFragments option
#723
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…ace around `ignoreCustomFragments` (default: false).
alexlamsl
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple of suggestions, otherwise LGTM.
README.md
Outdated
| | `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` | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given that you are removing whitespaces surrounding the custom fragments indiscriminately, may I suggest calling this trimCustomFragments?
README.md
Outdated
| | `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` | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given that you are removing whitespaces surrounding the custom fragments indiscriminately, may I suggest calling this trimCustomFragments?
| assert.equal(minify(input, { | ||
| collapseWhitespace: true, | ||
| collapseCustomFragments: true | ||
| }), output); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May I get a few more tests here with:
- whitespaces before and/or after
<? ... ?> - contents before and/or after
<? ... ?> - consecutive custom fragments
|
Renamed |
|
@adamchal thanks a lot! |
|
@alexlamsl no problem. Thanks for maintaining this. |
…in order to collapse white space around
ignoreCustomFragments(default: false). This resolves issue #722.Default behavior introduced from #436 is preserved. Only setting
collapseCustomFragmentstotruewill collapse the white space.Note: I did not add the the compiled files in
dist/in order to avoid merge conflict hell. Assumed you didn’t want that included in PRs.