Still minifying during local development #103
Replies: 3 comments 12 replies
-
I think it's the pretty option which I am after but it has been deprecated. Why? |
Beta Was this translation helpful? Give feedback.
-
Hello @binarykitchen, can you please provide the webpack config completely? What is used |
Beta Was this translation helpful? Give feedback.
-
Alternatively, if you won't use the pug-plugin, you can prettify the generated HTML using the postprocess callback option: const HtmlBundlerPlugin = require('html-bundler-webpack-plugin');
const formatHtml = require('js-beautify').html; // <= install the additional `js-beautify` package
const isDev = true; // <= you can self detect current mode
// formatting options: https://github.com/beautifier/js-beautify
const prettyOptions = {
html: {
indent_size: 2,
end_with_newline: true,
indent_inner_html: true,
preserve_newlines: true,
max_preserve_newlines: 0,
wrap_line_length: 120,
extra_liners: [],
space_before_conditional: true,
js: {
end_with_newline: false,
preserve_newlines: true,
max_preserve_newlines: 2,
space_after_anon_function: true,
},
css: {
end_with_newline: false,
preserve_newlines: false,
newline_between_rules: false,
},
},
};
const HtmlBundlerPlugin = require('html-bundler-webpack-plugin');
module.exports = {
plugins: [
new HtmlBundlerPlugin({
entry: {
index: './src/home.pug',
},
preprocessor: 'pug', // use the Pug compiler
postprocess: (content) => (isDev ? formatHtml(content, prettyOptions) : content), // pretty format of minified HTML
}),
],
}; this is source code of the pug-plugin ;-) |
Beta Was this translation helpful? Give feedback.
-
I've got this
For local development where NODE_ENV= development, yet the generated HTML is minified. A bug?
Using your latest version here.
Beta Was this translation helpful? Give feedback.
All reactions