@nurminen/html-beautify-webpack-plugin

1.1.4 • Public • Published

html-beautify-webpack-plugin

Beautifier for output of HtmlWebpackPlugin

Forked from https://github.com/seeyoulater/html-beautify-webpack-plugin

Updated to work with HtmlWebpackPlugin v4 from this comment

Installation

Install the plugin with npm:

$ npm i -D @nurminen/html-beautify-webpack-plugin

Usage

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

...
    plugins: [
        new HtmlWebpackPlugin()
        new HtmlBeautifyPlugin()
    ]
...
...
    plugins: [
        new HtmlWebpackPlugin()
        new HtmlBeautifyPlugin({
                config: {
                    html: {
                        end_with_newline: true,
                        indent_size: 2,
                        indent_with_tabs: true,
                        indent_inner_html: true,
                        preserve_newlines: true,
                        unformatted: ['p', 'i', 'b', 'span']
                    }
                },
                replace: [ ' type="text/javascript"' ]
            })
    ]
...
Order is important

Configuration

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

  • config: {...} js-beautify's options as object to beatify the output.
  • replace: [string | { test: (string | RegExp), with?: (string | func)}] Optional array of items to replace in destination file

Package Sidebar

Install

npm i @nurminen/html-beautify-webpack-plugin

Weekly Downloads

239

Version

1.1.4

License

MIT

Unpacked Size

5.56 kB

Total Files

4

Last publish

Collaborators

  • nurminen