Open maltsev opened 8 years ago
remove \n \t and ect
tree.match(/^\n\s*$/, () => '');
https://github.com/posthtml/project-stub/blob/master/gulpfile.js#L14-L18
@voischev the module collapseWhitespace
does that. Or did you find some error?
The biggest thing for me is to split out to separate plugins for individual test suites:
@maltsev normalize-html-whitespace is the most accurate. @voischev, the key is to normalize, not strip as to preserve rendered appearance.
@stevenvachon, first of all, thank you for new plugin ideas! I'll consider splitting out the modules to separate plugins. But it'll be much harder for me to maintain a few dozens small plugins (documentation, infrastructure) instead of one htmlnano
.
No problem. It's definitely more work to create separate projects, at least initially. Once created, it will make dealing with tests much easier because there're fewer of them and they're all very specific to one feature. This is how cssnano and cssnext are designed.
@stevenvachon, I agree with you. I'm also trying to write the modules and the tests as separated as possible, so it'll be easy to split off them later.
Whitespace within attributes containing space-separated lists can also be normalized:
<a href="#" class="class1 class2 " rel=" external nofollow ">link</a>
->
<a href="#" class="class1 class2" rel="external nofollow">link</a>
'
and "
(per attribute) as attribute value encapsulators to find which produces the smallest output (due to any necessary commenting: attr='blah \'blah\''
vs attr="blah 'blah'"
)attr=single_value
)@stevenvachon, thanks! I've created an issue for your first idea: #27 An issue for the second one is already there: #6
svgo for inline svg
</html>
, </head>
, </body>
, </option>
, </p>
, </thead>
, </tbody>
, </tfoot>
, </tr>
<html>
, <head>
, <body>
Strip HTML from content within <title></title>
tags as browsers and search engines will ignore it anyway.