Make WordPress Core

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#52158 closed defect (bug) (fixed)

Twenty Twenty-One: Clean up CSS build process

Reported by: ryelle's profile ryelle Owned by: ryelle's profile ryelle
Milestone: 5.7 Priority: normal
Severity: normal Version:
Component: Bundled Theme Keywords: has-patch commit
Focuses: Cc:

Description

The current Sass + PostCSS build process generates redundant code. The Sass step generates source map files we don't use, and the PostCSS step generates some duplicate code in ie.css & ie-editor.css. The PostCSS issue is a bug upstream, but we can work around it with postcss-discard-duplicates.

Change History (10)

This ticket was mentioned in PR #835 on WordPress/wordpress-develop by ryelle.


4 years ago
#1

  • Keywords has-patch added

This adds `postcss-discard-duplicates` to the PostCSS step to clean up the IE styles. All the CSS that is removed shows up again later in the file (in the case of, ex, blockquote cite). The duplicate media queries are due to a bug in postcss-css-variables.

Also, this has disabled source map generation in the sass, since these files are not to be committed. I'm open to leaving this out & instead adding *.map to gitignore - my main issue has been that they show up in my git changesets.

Trac ticket: https://core.trac.wordpress.org/ticket/52158#ticket

ryelle commented on PR #835:


4 years ago
#2

Reopening since I accidentally closed the PR.

#3 @SergeyBiryukov
4 years ago

  • Milestone changed from Awaiting Review to 5.7

carolinan commented on PR #835:


4 years ago
#4

There has been several requests to keep the map files. So much that Theme Check has been updated to allow .map files again. Twenty Nineteen also has a .map file so I think it should be included in the commit.

carolinan commented on PR #835:


4 years ago
#5

I have now tested the PR with and without https://github.com/WordPress/wordpress-develop/pull/806
and except for keeping the .map file it works well and solves the problem that prevented us from committing 806.

ryelle commented on PR #835:


4 years ago
#6

I dropped the change around .css.map files. These were intentionally ignored in r49576 - if we want to bring them back, we should un-ignore them in SVN and add the files, which should be done in a new ticket.

#7 @poena
4 years ago

  • Keywords commit added

This ticket was mentioned in Slack in #core-themes by poena. View the logs.


4 years ago

#9 @ryelle
4 years ago

  • Owner set to ryelle
  • Resolution set to fixed
  • Status changed from new to closed

In 49980:

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.

ryelle commented on PR #835:


4 years ago
#10

Committed in r49980.

Note: See TracTickets for help on using tickets.