Skip to content

Commit

Permalink
Make it possible to skip HTML minification
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandernst committed Jun 8, 2022
1 parent 7869e74 commit 4347c7f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/docusaurus/src/client/serverEntry.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions website/docs/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down

0 comments on commit 4347c7f

Please sign in to comment.