diff --git a/src/transforms/htmlnano.js b/src/transforms/htmlnano.js index 1b9c9092a27..7258b314668 100644 --- a/src/transforms/htmlnano.js +++ b/src/transforms/htmlnano.js @@ -7,6 +7,7 @@ module.exports = async function(asset) { const htmlNanoConfig = asset.package.htmlnano || (await asset.getConfig(['.htmlnanorc', '.htmlnanorc.js'])) || { collapseWhitespace: 'conservative', + removeRedundantAttributes: false, minifyCss: { safe: true } diff --git a/test/html.js b/test/html.js index b1867025d27..10cbd4212d2 100644 --- a/test/html.js +++ b/test/html.js @@ -290,6 +290,16 @@ describe('html', function() { ); }); + it('should not minify default values inside HTML in production mode', async function() { + await bundle(__dirname + '/integration/htmlnano-defaults-form/index.html', { + production: true + }); + + let html = fs.readFileSync(__dirname + '/dist/index.html', 'utf8'); + assert(html.includes('')); + assert(!html.includes('\n')); + }); + it('should not prepend the public path to assets with remote URLs', async function() { await bundle(__dirname + '/integration/html/index.html'); diff --git a/test/integration/htmlnano-defaults-form/index.html b/test/integration/htmlnano-defaults-form/index.html new file mode 100644 index 00000000000..57ebcc655c2 --- /dev/null +++ b/test/integration/htmlnano-defaults-form/index.html @@ -0,0 +1,11 @@ + + +
+