From 265180967328e94301fdef82c2fe8c4c30b7b9ca Mon Sep 17 00:00:00 2001 From: Kelly Choyce-Dwan Date: Mon, 18 Jan 2021 17:51:58 +0000 Subject: [PATCH] Twenty Twenty-One: Remove duplicate CSS rules. Introduces a new PostCSS plugin, `postcss-discard-duplicates`, which will automatically remove any duplicate CSS rules. All the CSS that is removed shows up again later in the file. This also fixes a bug from `postcss-css-variables`, where media queries are duplicated. Fixes #52158. Props poena. git-svn-id: https://develop.svn.wordpress.org/trunk@49980 602fd350-edb4-49c9-b593-d223f7449a82 --- .../twentytwentyone/assets/css/ie-editor.css | 58 ------------- .../themes/twentytwentyone/assets/css/ie.css | 85 ------------------- .../themes/twentytwentyone/package-lock.json | 23 +++-- .../themes/twentytwentyone/package.json | 1 + .../themes/twentytwentyone/postcss.config.js | 3 +- 5 files changed, 18 insertions(+), 152 deletions(-) diff --git a/src/wp-content/themes/twentytwentyone/assets/css/ie-editor.css b/src/wp-content/themes/twentytwentyone/assets/css/ie-editor.css index 1333b0be2594e..e77216365f2bf 100644 --- a/src/wp-content/themes/twentytwentyone/assets/css/ie-editor.css +++ b/src/wp-content/themes/twentytwentyone/assets/css/ie-editor.css @@ -149,15 +149,11 @@ blockquote p { blockquote cite { font-weight: normal; - color: #28303d; - font-size: 1rem; letter-spacing: normal; } blockquote footer { font-weight: normal; - color: #28303d; - font-size: 1rem; letter-spacing: normal; } @@ -387,14 +383,6 @@ a:hover { outline: 2px dotted #28303d; } -.has-background .has-link-color a { - color: #28303d; -} - -.has-background.has-link-color a { - color: #28303d; -} - .wp-block-button__link { line-height: 1.5; color: #d1e4dd; @@ -712,12 +700,6 @@ a:hover { font-size: 3rem; } } -@media only screen and (min-width: 652px) { - - .wp-block-cover h2 { - font-size: 3rem; - } -} .wp-block-cover-image h2 { font-size: 2.25rem; @@ -733,12 +715,6 @@ a:hover { font-size: 3rem; } } -@media only screen and (min-width: 652px) { - - .wp-block-cover-image h2 { - font-size: 3rem; - } -} .wp-block-cover h2.has-text-align-left, .wp-block-cover-image h2.has-text-align-left { @@ -1304,13 +1280,6 @@ h1 { } } -@media only screen and (min-width: 652px) { - - .wp-block-heading h2 { - font-size: 3rem; - } -} - h2 { font-size: 2.25rem; letter-spacing: normal; @@ -1324,13 +1293,6 @@ h2 { } } -@media only screen and (min-width: 652px) { - - h2 { - font-size: 3rem; - } -} - .h2 { font-size: 2.25rem; letter-spacing: normal; @@ -1344,13 +1306,6 @@ h2 { } } -@media only screen and (min-width: 652px) { - - .h2 { - font-size: 3rem; - } -} - .wp-block-heading h3 { font-size: 2rem; letter-spacing: normal; @@ -3133,17 +3088,6 @@ pre.wp-block-verse { color: #39414d; } -.has-background a, -.has-background p, -.has-background h1, -.has-background h2, -.has-background h3, -.has-background h4, -.has-background h5, -.has-background h6 { - color: currentColor; -} - .has-primary-background-color[class] { background-color: #28303d; color: #d1e4dd; @@ -3155,12 +3099,10 @@ pre.wp-block-verse { } .has-white-background-color[class] { - background-color: #fff; color: #39414d; } .has-black-background-color[class] { - background-color: #000; color: #28303d; } diff --git a/src/wp-content/themes/twentytwentyone/assets/css/ie.css b/src/wp-content/themes/twentytwentyone/assets/css/ie.css index 1308620af3a9a..96653cebb090f 100644 --- a/src/wp-content/themes/twentytwentyone/assets/css/ie.css +++ b/src/wp-content/themes/twentytwentyone/assets/css/ie.css @@ -545,8 +545,6 @@ template { */ .post-thumbnail { max-width: calc(100vw - 30px); - margin-left: auto; - margin-right: auto; } @media only screen and (min-width: 482px) { @@ -635,8 +633,6 @@ template { .widget-area { max-width: calc(100vw - 30px); - margin-left: auto; - margin-right: auto; } @media only screen and (min-width: 482px) { @@ -715,8 +711,6 @@ template { .site-footer { max-width: calc(100vw - 30px); - margin-left: auto; - margin-right: auto; } @media only screen and (min-width: 482px) { @@ -735,8 +729,6 @@ template { .site-header { max-width: calc(100vw - 30px); - margin-left: auto; - margin-right: auto; } @media only screen and (min-width: 482px) { @@ -923,12 +915,6 @@ template { margin-left: calc(50vw - min(calc(100vw - 4 * 25px), 610px) *1); } } - @media only screen and (min-width: 482px) { - - .entry-content > .alignleft { - margin-left: calc(50vw - min(calc(100vw - 4 * 25px), 610px) *1); - } - } @media only screen and (min-width: 822px) { .entry-content > .alignleft { @@ -952,12 +938,6 @@ template { margin-right: calc(50vw - min(calc(100vw - 4 * 25px), 610px) *1); } } - @media only screen and (min-width: 482px) { - - .entry-content > .alignright { - margin-right: calc(50vw - min(calc(100vw - 4 * 25px), 610px) *1); - } - } @media only screen and (min-width: 822px) { .entry-content > .alignright { @@ -1379,15 +1359,11 @@ blockquote p { blockquote cite { font-weight: normal; - color: #28303d; - font-size: 1rem; letter-spacing: normal; } blockquote footer { font-weight: normal; - color: #28303d; - font-size: 1rem; letter-spacing: normal; } @@ -2100,8 +2076,6 @@ fieldset input[type=checkbox] + label { img { display: block; - height: auto; - max-width: 100%; } /* Classic editor images */ @@ -2892,12 +2866,6 @@ input[type=reset]:hover { font-size: 3rem; } } -@media only screen and (min-width: 652px) { - - .wp-block-cover h2 { - font-size: 3rem; - } -} .wp-block-cover-image h2 { font-size: 2.25rem; @@ -2913,12 +2881,6 @@ input[type=reset]:hover { font-size: 3rem; } } -@media only screen and (min-width: 652px) { - - .wp-block-cover-image h2 { - font-size: 3rem; - } -} .wp-block-cover h2.has-text-align-left, .wp-block-cover-image h2.has-text-align-left { @@ -3372,13 +3334,6 @@ h2 { } } -@media only screen and (min-width: 652px) { - - h2 { - font-size: 3rem; - } -} - .h2 { font-size: 2.25rem; letter-spacing: normal; @@ -3392,13 +3347,6 @@ h2 { } } -@media only screen and (min-width: 652px) { - - .h2 { - font-size: 3rem; - } -} - h3 { font-size: 2rem; letter-spacing: normal; @@ -5379,13 +5327,6 @@ table.wp-calendar-table caption { } } - @media only screen and (min-width: 482px) { - - .entry-content > .alignleft { - max-width: calc(50% - 50vw + min(calc(100vw - 4 * 25px), 610px) *1); - } - } - @media only screen and (min-width: 822px) { .entry-content > .alignleft { @@ -5454,13 +5395,6 @@ table.wp-calendar-table caption { } } - @media only screen and (min-width: 482px) { - - .entry-content > .alignright { - max-width: calc(50% - 50vw + min(calc(100vw - 4 * 25px), 610px) *1); - } - } - @media only screen and (min-width: 822px) { .entry-content > .alignright { @@ -5856,13 +5790,6 @@ a.custom-logo-link { } } -@media only screen and (min-width: 652px) { - - .entry-title { - font-size: 3rem; - } -} - .entry-title a { color: currentColor; text-underline-offset: 0.15em; @@ -6263,12 +6190,6 @@ h1.page-title { font-size: 3rem; } } -@media only screen and (min-width: 652px) { - - .comments-title { - font-size: 3rem; - } -} .comment-reply-title { font-size: 2.25rem; @@ -6280,12 +6201,6 @@ h1.page-title { font-size: 3rem; } } -@media only screen and (min-width: 652px) { - - .comment-reply-title { - font-size: 3rem; - } -} .comment-reply-title { display: flex; diff --git a/src/wp-content/themes/twentytwentyone/package-lock.json b/src/wp-content/themes/twentytwentyone/package-lock.json index ec3a6173a0d1e..f635c72486802 100644 --- a/src/wp-content/themes/twentytwentyone/package-lock.json +++ b/src/wp-content/themes/twentytwentyone/package-lock.json @@ -413,14 +413,6 @@ "globals": "^12.0.0", "prettier": "npm:wp-prettier@2.0.5", "requireindex": "^1.2.0" - }, - "dependencies": { - "prettier": { - "version": "npm:wp-prettier@2.0.5", - "resolved": "https://registry.npmjs.org/wp-prettier/-/wp-prettier-2.0.5.tgz", - "integrity": "sha512-5GCgdeevIXwR3cW4Qj5XWC5MO1iSCz8+IPn0mMw6awAt/PBiey8yyO7MhePRsaMqghJAhg6Q3QLYWSnUHWkG6A==", - "dev": true - } } }, "@wordpress/prettier-config": { @@ -3010,6 +3002,15 @@ "postcss": "^7.0.14" } }, + "postcss-discard-duplicates": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/postcss-discard-duplicates/-/postcss-discard-duplicates-4.0.2.tgz", + "integrity": "sha512-ZNQfR1gPNAiXZhgENFfEglF93pciw0WxMkJeVmw8eF+JZBbMD7jp6C67GqJAXVZP2BWbOztKfbsdmMp/k8c6oQ==", + "dev": true, + "requires": { + "postcss": "^7.0.0" + } + }, "postcss-focus-within": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/postcss-focus-within/-/postcss-focus-within-3.0.0.tgz", @@ -3179,6 +3180,12 @@ "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", "dev": true }, + "prettier": { + "version": "npm:wp-prettier@2.0.5", + "resolved": "https://registry.npmjs.org/wp-prettier/-/wp-prettier-2.0.5.tgz", + "integrity": "sha512-5GCgdeevIXwR3cW4Qj5XWC5MO1iSCz8+IPn0mMw6awAt/PBiey8yyO7MhePRsaMqghJAhg6Q3QLYWSnUHWkG6A==", + "dev": true + }, "prettier-linter-helpers": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz", diff --git a/src/wp-content/themes/twentytwentyone/package.json b/src/wp-content/themes/twentytwentyone/package.json index 33117d94501cf..ae063423f8f98 100644 --- a/src/wp-content/themes/twentytwentyone/package.json +++ b/src/wp-content/themes/twentytwentyone/package.json @@ -24,6 +24,7 @@ "postcss-cli": "^7.1.0", "postcss-css-variables": "^0.17.0", "postcss-custom-media": "^7.0.8", + "postcss-discard-duplicates": "^4.0.2", "postcss-focus-within": "^3.0.0", "postcss-nested": "^4.2.1", "rtlcss": "^2.6.1", diff --git a/src/wp-content/themes/twentytwentyone/postcss.config.js b/src/wp-content/themes/twentytwentyone/postcss.config.js index 5287737ec2d2c..c291aae9e6b65 100644 --- a/src/wp-content/themes/twentytwentyone/postcss.config.js +++ b/src/wp-content/themes/twentytwentyone/postcss.config.js @@ -7,6 +7,7 @@ module.exports = { }), require('postcss-calc')({ precision: 0 - }) + }), + require('postcss-discard-duplicates') ] };