Andrew Fletcher published: 20 July 2023 1 minute read
I've been working on a problem where a font and image tag aren't appearing on the front end of my website. I found that if I disable CSS aggregation, the YouTube play button symbol and overlay will appear. However, this slows down the page speed.
How to leverage CSS aggregation but set specific files to be excluded?
I'm wondering how to leverage CSS aggregation but exclude specific files. Here's an example of what my theme libraries file looks like:
global-styling:
version: 1.x
header: true
css:
base:
assets/dist/css/tailwind.css: {}
assets/dist/css/style.css: {}
assets/dist/css/responsive.css: {}
theme:
assets/dist/css/editor.css: {}
assets/dist/css/layout.css: {}
assets/dist/css/navigation.css: {}
assets/dist/css/headers.css: {}
assets/dist/css/button-link.css: {}
assets/dist/css/misc.css: {}
assets/dist/css/homepage.css: {}
assets/dist/css/forms.css: {}
assets/dist/css/vendors.css: {}
dependencies:
- core/jquery
- core/drupal
- core/jquery.once
- core/drupal.ajax
- core/views.ajax
To exclude a CSS file, you need to add { preprocess: false } against the relevant file. To exclude misc.css file it will look as follows:
global-styling:
version: 1.x
header: true
css:
base:
assets/dist/css/tailwind.css: {}
assets/dist/css/style.css: {}
assets/dist/css/responsive.css: {}
theme:
assets/dist/css/editor.css: {}
assets/dist/css/layout.css: {}
assets/dist/css/navigation.css: {}
assets/dist/css/headers.css: {}
assets/dist/css/button-link.css: {}
assets/dist/css/misc.css: { preprocess: false }
assets/dist/css/homepage.css: {}
assets/dist/css/forms.css: {}
assets/dist/css/vendors.css: {}
dependencies:
- core/jquery
- core/drupal
- core/jquery.once
- core/drupal.ajax
- core/views.ajax
Related articles
Andrew Fletcher
•
09 Jan 2026
Upgrading Drupal from 10.6.x to 11.3.2: a practical, dependency-driven walkthrough
Upgrading from Drupal 10.6.x to 11.3.x is officially supported, but in real projects it’s rarely a single command. The friction usually comes from **Composer constraints**, not Drupal itself.This article documents a real-world upgrade path from Drupal 10.6.1 → 11.3.2, including the specific blockers...
Andrew Fletcher
•
04 Apr 2025
Managing .gitignore changes
When working with Git, the .gitignore file plays a critical role in controlling which files and folders are tracked by version control. Yet, many developers are unsure when changes to .gitignore take effect and how to manage files that are already being tracked. This uncertainty can lead to...
Andrew Fletcher
•
26 Mar 2025
How to fix the ‘Undefined function t’ error in Drupal 10 or 11 code
Upgrading to Drupal 10.4+ you might have noticed a warning in their code editor stating “Undefined function ‘t’”. While Drupal’s `t()` function remains valid in procedural code, some language analysis tools — such as Intelephense — do not automatically recognise Drupal’s global functions. This...