package
A posthtml plugin remove whitespace between HTML tags
npm install posthtml-spacelessGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Tagged topics.
Estimated unpacked size across 9 packages.
787.4 kB
Includes dependencies.
2 direct · 2 outdated
^0.3.0
0.13.0
1.0.6
3.0.0
A posthtml plugin remove whitespace between HTML tags
This tag is based on and compatible with the Twig spaceless tag, Swig spaceless tag and Django spaceless tag.
npm i -D posthtml posthtml-spacelessNote: This project is compatible with node v4+
import {readFileSync, writeFileSync} from 'fs';
import posthtml from 'posthtml';
import spaceless from 'posthtml-spaceless';
const html = readFileSync('input.html', 'utf8');
posthtml()
.use(spaceless())
.process(html)
.then(result => {
writeFileSync('output.html', result.html);
});
Returns the html without whitespace between tags
<!DOCTYPE html>
<html>
<head></head>
<body>
<h2>Header</h2>
<spaceless>
<ul>
<li>one</li>
<li>two</li>
<li>three</li>
</ul>
</spaceless>
</body>
<!DOCTYPE html>
<html>
<head></head>
<body>
<h2>Header</h2>
<ul><li>one</li><li>two</li><li>three</li></ul>
</body>
</html>voischev
voischev.ivan@ya.ru