html-minifier-without-js

0.0.7 • Public • Published

HTMLMinifier-Without-js

You probably want to use original lib - https://github.com/kangax/html-minifier

Get started

Install

npm i html-minifier-without-js

Example 1

import { minify } from 'html-minifier-without-js/src/htmlminifier.js'


let htmlSource = '<div id="home_con-h1">                  <h1>TEST H1</h1>                            <h2>TEST H2</h2></div>                <p title="blah" id="moo">    foo       </p>';
var result = minify(htmlSource, 
{
    collapseWhitespace: true, //удаляем пустые пространства между тегами
    removeComments: true, //удаляем коментарии
    removeScriptTypeAttributes: true, //Remove type="text/javascript" from script tags. Other type attribute values are left intact
    includeAutoGeneratedTags: false,
    ignoreCustomComments: [ // ignore noindex comments
        /^noindex/,
        /\/noindex+$/
    ], 
    minifyCSS: true, //минифицирует JS
    trimCustomFragments: true, //Удаляет пустой пространство около игнорируемых элементов
    //ignoreCustomFragments: [ (/\{\%[^\%]*?\%\}(\s)?/g) ], //Игнорирования тега
});

console.log(result);

/html-minifier-without-js/

    Package Sidebar

    Install

    npm i html-minifier-without-js

    Weekly Downloads

    1

    Version

    0.0.7

    License

    MIT

    Unpacked Size

    67.1 kB

    Total Files

    6

    Last publish

    Collaborators

    • yuriy-svetlov