- Issue created by @brayn7
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.
Active
Code