Incorporate media queries in aggregated CSS files, don't create a new group for each new media query

Created on 18 March 2012, over 12 years ago
Updated 20 August 2023, over 1 year ago

Problem/Motivation

Currently, whenever a CSS file is added that uses a media query in the options array it creates a new aggregation group when processed. This introduces a frontend performance issue on sites that use many different media queries as it potentially raises the number of aggregates drastically. For example, if a media query dependent stylesheet is added in the middle of a group of CSS files the current behavior causes the creation of 3 aggregates instead of just one (pre-media-query-stylesheets / media-query-stylesheets / post-media-query-stylesheets).

Proposed resolution

Ignore the media query option of stylesheets that have 'preprocess' set to TRUE when CSS aggregation is enabled and write the media query into the CSS aggregate instead (wrap it around the string content of that file when building the cache).

Remaining tasks

Tests, maybe.

API changes

None. It doesn't have an effect on the weighting of stylesheets either.

πŸ“Œ Task
Status

Closed: outdated

Version

9.5

Component
CSSΒ  β†’

Last updated 5 days ago

Created by

πŸ‡¦πŸ‡ΉAustria fubhy

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

    It affects performance. It is often combined with the Needs profiling tag.

  • mobile

    Issue related to Drupal on mobile devices.

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.

Production build 0.71.5 2024