entr / html-beautify-webpack-plugin

Beautifier for HtmlWebpackPlugin's output

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

@entr/html-beautify-webpack-plugin

Beautifier for output of HtmlWebpackPlugin for Webpack 4 and html-webpack-plugin 4

Installation

Install the plugin with npm:

npm i -D @entr/html-beautify-webpack-plugin

yarn

yarn add -D @entr/html-beautify-webpack-plugin

Usage

const HtmlWebpackPlugin = require('html-webpack-plugin');
const HtmlBeautifyPlugin = require('@entr/html-beautify-webpack-plugin@alpha');

...
    plugins: [
        new HtmlWebpackPlugin()
        new HtmlBeautifyPlugin()
    ]
...
...
    plugins: [
        new HtmlWebpackPlugin()
        new HtmlBeautifyPlugin({
                beautifyOptions: {
                    html: {
                        end_with_newline: true,
                        indent_size: 2,
                        indent_with_tabs: true,
                        indent_inner_html: true,
                        preserve_newlines: true,
                        unformatted: ['p', 'i', 'b', 'span']
                    }
                }
            })
    ]
...

Order is important

Configuration

You can pass a configuration options. Allowed values are as follows:

  • beautifyOptions: {...} js-beautify's options as object to beatify the output.

About

Beautifier for HtmlWebpackPlugin's output

License:MIT License


Languages

Language:JavaScript 100.0%