Still minifying during local development #103
Closed
binarykitchen
started this conversation in
General
Replies: 3 comments 12 replies
|
I think it's the pretty option which I am after but it has been deprecated. Why? |
10 replies
|
Hello @binarykitchen, can you please provide the webpack config completely? What is used |
1 reply
|
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 ;-) |
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
I've got this
For local development where NODE_ENV= development, yet the generated HTML is minified. A bug?
Using your latest version here.
All reactions