Make WordPress Core

Opened 4 years ago

Closed 3 years ago

Last modified 3 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:


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

  • 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:

ryelle commented on PR #835:

4 years ago

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

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

I have now tested the PR with and without
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:

3 years ago

I dropped the change around 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
3 years ago

  • Keywords commit added

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

3 years ago

#9 @ryelle
3 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:

3 years ago

Committed in r49980.

Note: See TracTickets for help on using tickets.