From f9bc0b8eda9d9e6217e4b5d8f45d80428ea406d7 Mon Sep 17 00:00:00 2001 From: David Pang Date: Fri, 10 Jun 2022 10:44:45 -0400 Subject: [PATCH 1/3] fix(cssnano-preset): disable z-index minification --- packages/docusaurus-cssnano-preset/src/index.ts | 2 ++ .../_dogfooding/_pages tests/z-index-test.tsx | 17 +++++++++++++++++ website/_dogfooding/dogfooding.css | 4 ++++ website/docs/cli.md | 4 +++- 4 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 website/_dogfooding/_pages tests/z-index-test.tsx diff --git a/packages/docusaurus-cssnano-preset/src/index.ts b/packages/docusaurus-cssnano-preset/src/index.ts index 6bae42c6f8c7..ddea9fc0ed9c 100644 --- a/packages/docusaurus-cssnano-preset/src/index.ts +++ b/packages/docusaurus-cssnano-preset/src/index.ts @@ -13,6 +13,8 @@ const preset: typeof advancedBasePreset = function preset(opts) { const advancedPreset = advancedBasePreset({ autoprefixer: {add: false}, discardComments: {removeAll: true}, + /* cSpell:ignore zindex */ + zindex: false, ...opts, }); diff --git a/website/_dogfooding/_pages tests/z-index-test.tsx b/website/_dogfooding/_pages tests/z-index-test.tsx new file mode 100644 index 000000000000..d1d076b89495 --- /dev/null +++ b/website/_dogfooding/_pages tests/z-index-test.tsx @@ -0,0 +1,17 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +import React from 'react'; +import Layout from '@theme/Layout'; + +export default function zIndexTest(): JSX.Element { + return ( + +

This should have a z-index of 100

+
+ ); +} diff --git a/website/_dogfooding/dogfooding.css b/website/_dogfooding/dogfooding.css index be6cf970b6f9..f1864ef8fb82 100644 --- a/website/_dogfooding/dogfooding.css +++ b/website/_dogfooding/dogfooding.css @@ -20,3 +20,7 @@ html.plugin-blog.plugin-id-blog-tests .navbar { html.plugin-pages.plugin-id-pages-tests .navbar { border-bottom: solid thin yellow; } + +#z-index-test { + z-index: 100; +} diff --git a/website/docs/cli.md b/website/docs/cli.md index 92bf71a80633..ae7878e4718d 100644 --- a/website/docs/cli.md +++ b/website/docs/cli.md @@ -92,7 +92,9 @@ Compiles your site for production. :::info -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.** + + +For advanced minification of CSS bundle, we use the [advanced cssnano preset](https://github.com/cssnano/cssnano/tree/master/packages/cssnano-preset-advanced) with [postcss-zindex](https://github.com/cssnano/cssnano/tree/master/packages/postcss-zindex) disabled. We also use several additional 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.** ::: From 4df4390839a0567f0f7d95d848826224d1384268 Mon Sep 17 00:00:00 2001 From: David Pang Date: Fri, 10 Jun 2022 11:14:02 -0400 Subject: [PATCH 2/3] add z-index tests link to pages tests --- website/_dogfooding/_pages tests/index.md | 1 + .../_pages tests/{z-index-test.tsx => z-index-tests.tsx} | 0 2 files changed, 1 insertion(+) rename website/_dogfooding/_pages tests/{z-index-test.tsx => z-index-tests.tsx} (100%) diff --git a/website/_dogfooding/_pages tests/index.md b/website/_dogfooding/_pages tests/index.md index cf94300fb891..d54f03fcd3f6 100644 --- a/website/_dogfooding/_pages tests/index.md +++ b/website/_dogfooding/_pages tests/index.md @@ -28,3 +28,4 @@ import Readme from "../README.md" - [General Markdown tests](/tests/pages/markdownPageTests) - [TOC tests](/tests/pages/page-toc-tests) - [Tabs tests](/tests/pages/tabs-tests) +- [z-index tests](/tests/pages/z-index-tests) diff --git a/website/_dogfooding/_pages tests/z-index-test.tsx b/website/_dogfooding/_pages tests/z-index-tests.tsx similarity index 100% rename from website/_dogfooding/_pages tests/z-index-test.tsx rename to website/_dogfooding/_pages tests/z-index-tests.tsx From aae5fb9e21d619565eaa4a7fdecfa1f94fd30681 Mon Sep 17 00:00:00 2001 From: David Pang Date: Fri, 10 Jun 2022 11:21:30 -0400 Subject: [PATCH 3/3] revert change to docs --- website/docs/cli.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/website/docs/cli.md b/website/docs/cli.md index ae7878e4718d..92bf71a80633 100644 --- a/website/docs/cli.md +++ b/website/docs/cli.md @@ -92,9 +92,7 @@ Compiles your site for production. :::info - - -For advanced minification of CSS bundle, we use the [advanced cssnano preset](https://github.com/cssnano/cssnano/tree/master/packages/cssnano-preset-advanced) with [postcss-zindex](https://github.com/cssnano/cssnano/tree/master/packages/postcss-zindex) disabled. We also use several additional 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.** +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.** :::