Use PostCSS Custom Media's importFrom option to import breakpoints into core's CSS

Created on 8 December 2021, over 2 years ago
Updated 30 January 2023, over 1 year ago

This is a followup from #3253148: Remove IE from core's browserlist, remove non-essential CSS importing and recompile assets β†’ .

The Olivero theme uses PostCSS Custom Media to abstract media queries into variables.

To use those, we import these into each CSS file:

/**
 * @file
 * Styles for action links.
*/
@import "../base/media-queries.pcss.css";

.action-links {

However, this leaves the source comments from media-queries.pcss.css in the resulting compiled CSS file.

This increases the filesize of the CSS files when Drupal's CSS aggregation is disabled.

Potential Solution

We use PostCSS Custom Media's importFrom option instead of directly importing the CSS into each PCSS file.

The tricky part is that this setting would be global for all of Drupal core, so we'd likely want to namespace the custom CSS media variables (eg rename --nav to --olivero--nav.

πŸ“Œ Task
Status

Needs work

Version

10.0 ✨

Component
CSSΒ  β†’

Last updated 1 day ago

Created by

πŸ‡ΊπŸ‡ΈUnited States mherchel Gainesville, FL, US

Live updates comments and jobs are added and updated live.
  • CSS

    It involves the content or handling of Cascading Style Sheets.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • The Needs Review Queue Bot β†’ tested this issue. It either no longer applies to Drupal core, or fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".

    Apart from a re-roll or rebase, this issue may need more work to address feedback in the issue or MR comments. To progress an issue, incorporate this feedback as part of the process of updating the issue. This helps other contributors to know what is outstanding.

    Consult the Drupal Contributor Guide β†’ to find step-by-step guides for working with issues.

Production build 0.71.5 2024