mirror of
https://github.com/facebook/docusaurus.git
synced 2025-04-29 18:27:56 +02:00
feat(core): allow opting out of HTML minification (#7581)
This commit is contained in:
parent
1f0440074a
commit
b503523f66
2 changed files with 6 additions and 0 deletions
|
@ -142,6 +142,10 @@ async function doRender(locals: Locals & {path: string}) {
|
|||
});
|
||||
|
||||
try {
|
||||
if (process.env.SKIP_HTML_MINIFICATION === 'true') {
|
||||
return renderedHtml;
|
||||
}
|
||||
|
||||
// Minify html with https://github.com/DanielRuf/html-minifier-terser
|
||||
return await minify(renderedHtml, {
|
||||
removeComments: false,
|
||||
|
|
|
@ -94,6 +94,8 @@ Compiles your site for production.
|
|||
|
||||
For advanced minification of CSS bundle, we use the [advanced cssnano preset](https://github.com/cssnano/cssnano/tree/master/packages/cssnano-preset-advanced) (along with additional several PostCSS plugins) and [level 2 optimization of clean-css](https://github.com/jakubpawlowicz/clean-css#level-2-optimizations). If as a result of this advanced CSS minification you find broken CSS, build your website with the environment variable `USE_SIMPLE_CSS_MINIFIER=true` to minify CSS with the [default cssnano preset](https://github.com/cssnano/cssnano/tree/master/packages/cssnano-preset-default). **Please [fill out an issue](https://github.com/facebook/docusaurus/issues/new?labels=bug%2C+needs+triage&template=bug.md) if you experience CSS minification bugs.**
|
||||
|
||||
You can skip the HTML minification with the environment variable `SKIP_HTML_MINIFICATION=true`.
|
||||
|
||||
:::
|
||||
|
||||
### `docusaurus swizzle [themeName] [componentName] [siteDir]` {#docusaurus-swizzle}
|
||||
|
|
Loading…
Add table
Reference in a new issue