Make WordPress Core

Opened 7 months ago

#50627 new enhancement

CSS Build process: Consider removing autoprefixer from the source folder.

Reported by: youknowriad Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Build/Test Tools Keywords:
Focuses: css Cc:


Right now, the CSS build process is a bit unclear to me. It seems like there's a precommit hook to apply postcss autoprefixer to the CSS fils in src folder. This results in "source code" and "built code" to be mixed together.

The issue becomes more apparent as we explore using new techologies list CSS custom properties. If we continue with the current setup it means we'd have to include in the source code both the CSS variables used, and the necessary fallback for IE11 (as CSS variables are not supported there). So whenever we want to change the value of the CSS variable, we'd have to update all the fallback values, diminishing the value of the CSS variable in the first place.

Autoprefixer and CSS Custom properties are the examples I have in mind right now, but this can be problematic for any similar CSS feature we'd be interested in.

I think we should consider only applying the PostCSS tweaks (autoprefixer) to the build folder only. The downside is that the source "css" files won't have the necessary fallbacks for legacy browsers but they will still continue to work in most recent browsers.

In an ideal world, source and dist are completely different but it's too soon for that as a lot of core developers still use the "src" folder.

Change History (0)

Note: See TracTickets for help on using tickets.