htmlclean
Version:
Simple and safety HTML/SVG cleaner to minify without changing its structure.
14 lines • 1.36 kB
HTML
<html><body><!--[if lt IE 7]>This line will be kept.<![endif]--><p>The more than two whitespaces, tabs and line-breaks will be suppressed to one space.</p><p> <em><i>The</i> <font><i>clean</i> HTML</font></em> is here.</p><p>The <strong>clean <span><em>HTML is here.</em></span></strong></p><p class="clean">The vain whitespaces<br/> in tags.</p><script>
var foo = 'The text in script element' +
' will be kept.';
</script><script type="text/x-handlebars-template">
<!-- These are unprotected by option -->
<div>
<div>{{firstName}}</div>
<div>{{lastName}}</div>
</div>
</script><div title="The whitespaces before 'title' will be suppressed to one space. This text will be
kept.">The tabs and</div><div>line-breaks between HTML tags will be removed.</div><div><span>'</span> <span>'</span> is one space(this will be kept).</div><div><!--#echo var="LAST_MODIFIED" -->Apache SSI tag will be kept.</div>
$foo = 'The text in PHP code';
<div>Here,
text will be kept.</div><div></div><div></div><div title="This egg is protected.">These Eggs are unprotected.</div><svg version="1.1"><rect x="3" y="3" width="42" height="18" rx="5" ry="5"/><path d="M13 9 15 8"/><text>This is text in SVG.</text><text>This is text in <tspan font-size="1.5em">SVG<tspan font-size="0.9em">.</tspan></tspan></text></svg></body></html>