WordPress.org

Make WordPress Core

Opened 2 months ago

Closed 6 weeks ago

Last modified 6 weeks ago

#52158 closed defect (bug) (fixed)

Twenty Twenty-One: Clean up CSS build process

Reported by: ryelle Owned by: 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.


2 months 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: https://core.trac.wordpress.org/ticket/52158#ticket

#2 @prbot
8 weeks ago

ryelle commented on PR #835:

Reopening since I accidentally closed the PR.

#3 @SergeyBiryukov
8 weeks ago

  • Milestone changed from Awaiting Review to 5.7

#4 @prbot
8 weeks ago

carolinan commented on PR #835:

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.

#5 @prbot
8 weeks ago

carolinan commented on PR #835:

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.

#6 @prbot
7 weeks ago

ryelle commented on PR #835:

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
6 weeks ago

  • Keywords commit added

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


6 weeks ago

#9 @ryelle
6 weeks 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.

#10 @prbot
6 weeks ago

ryelle commented on PR #835:

Committed in r49980.

Note: See TracTickets for help on using tickets.