Optimization of Css and aggregates

Created on 17 October 2023, 9 months ago

Problem/Motivation

If I understand things correctly if everything is aggregated and we are using layout builder that means we can many different aggregated files. Potentially a file for each layout builder page could be different and sense the browser caches files that means it has to download the whole file for each layout builder variant. To mitigate some of the download I wonder if we figure out the best way to tell certain SDC's to not be aggregated into the aggregated file by using the library key "preprocess". When this is set to false this library loads the single file for that library by itself. With http2 this could be a plus. This would be handy for things we load on every page like the header and the footer. reducing the main agg file. Creating cached unchanged/variant css files for the header and footer that, once loaded once, can be brought to the page from the browser now without having to download a new variation because there is a new/different block on a layout builder page.

Also potentially worth noting that there is a aggregate grouping function within the aggregation functionality of core we could utilize instead. https://www.drupal.org/docs/develop/standards/css/css-file-organization β†’

Additionally it is worth looking into the weighting of styles.

Base β€” CSS reset/normalize plus HTML element styling.
Layout β€” macro arrangement of a web page, including any grid systems.
Component β€” discrete, reusable UI elements.
State β€” styles that deal with client-side changes to components.
Theme β€” purely visual styling (β€œlook-and-feel”) for a component.

Drupal follows this in terms of style categorization and weighting when it comes to loading and aggregating. Therefore we should comb thru and ensure we have the correct keys in the correct places.

✨ Feature request
Status

Active

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States brayn7 Lexington, Ky

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.69.0 2024