UglifyJsPlugin seems to remove a text type attribute of the input tag from html string that loaded by html-loader

I built and uglified a source code that requires some html files using html-loder. webpack.optimize.UglifyJsPlugin seems to remove a text type attribute of the input tag from html string.

The default value of the type attribute is text. But the CSS selector such as input[type="text"] does not applied if the type attribute is removed.

My test repository is here.

Now, I’m uglifying on another task using grunt-contrib-uglify for work arround.

Author: Fantashit

4 thoughts on “UglifyJsPlugin seems to remove a text type attribute of the input tag from html string that loaded by html-loader

  1. That’s not actual an issue imho, but you can argue about the aggressiveness of the html minifier ^^. Removing the attribute to save space is correct, because the default is text… maybe you should adjust your css to match input fields without a type attribute.

  2. Yeah this is really thrashing my HTML, at least with an Ractive project – it’s skipping closing tags and breaking the output.

  3. To solve this problem set minimize = false for loader html in you webpack configuration file
    I spend half of my workday to find out it

    For example:

    {
        modules:
            loaders: {
                { test: /\.html$/, loader: "html?minimize=false" }
            }    
    }
    

    Particularly you can disable removeRedundantAttributes option

    There’s a not obvious behavior in webpack workflow 🙁

Comments are closed.