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.


Built from https://develop.svn.wordpress.org/trunk@49980


git-svn-id: http://core.svn.wordpress.org/trunk@49681 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryelle 2021-01-18 17:53:09 +00:00
parent 489e47692a
commit 524d6bb167
6 changed files with 19 additions and 153 deletions

View File

@ -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;
}

View File

@ -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;

View File

@ -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",

View File

@ -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",

View File

@ -7,6 +7,7 @@ module.exports = {
}),
require('postcss-calc')({
precision: 0
})
}),
require('postcss-discard-duplicates')
]
};

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.7-alpha-49979';
$wp_version = '5.7-alpha-49980';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.