Skip to content

Conversation

@adamchal
Copy link
Contributor

…in order to collapse white space around ignoreCustomFragments (default: false). This resolves issue #722.

Default behavior introduced from #436 is preserved. Only setting collapseCustomFragments to true will 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.

…ace around `ignoreCustomFragments` (default: false).
Copy link
Collaborator

@alexlamsl alexlamsl left a 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` |
Copy link
Collaborator

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` |
Copy link
Collaborator

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);
Copy link
Collaborator

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
@adamchal
Copy link
Contributor Author

Renamed collapseCustomFragments to trimCustomFragments and added more tests with suggested scenarios.

@alexlamsl alexlamsl merged commit b7068fb into kangax:gh-pages Sep 25, 2016
@alexlamsl
Copy link
Collaborator

@adamchal thanks a lot!

@adamchal
Copy link
Contributor Author

@alexlamsl no problem. Thanks for maintaining this.

@adamchal adamchal deleted the issue-722 branch September 25, 2016 21:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants