^10.1 CSS aggregation breaks during maintenance mode

Created on 7 July 2023, over 1 year ago
Updated 5 June 2024, 9 months ago

Problem/Motivation

CSS aggregation isn't automatically disabled in ^10.1 in maintenance mode and doesn't aggregate CSS for users without the 'access site in maintenance mode' permission, resulting in unstyled pages.

Steps to reproduce

  1. Install Drupal core ^10.1
  2. Make sure no aggregated CSS for the maintenance page is saved to disk. Delete the aggregated asset directory if necessary.
  3. Enable CSS aggregation and turn on maintenance mode.
  4. Visit the site with a user that does not have the 'access site in maintenance mode' permission. You should end up with an unstyled page.
  5. Check the browser console; in both Firefox and Chrome, you should see some variation of an error that the aggregated CSS was not loaded due to corrupt or incorrect content type, as it's actually serving the maintenance page HTML rather than CSS.

Proposed resolution

At Neurocracy/Omnipedia we settled on adding '_maintenance_access': true option to the 'system.css_asset' route as a workaround to allow us to use aggregated CSS, but a better solution may be to disable CSS aggregation automatically like JS aggregation seems to be in maintenance mode.

Remaining tasks

TBD.

User interface changes

CSS actually loads.

API changes

None?

Data model changes

None?

Release notes snippet

TBD.

🐛 Bug report
Status

Fixed

Version

10.1

Component
Asset library 

Last updated 2 days ago

No maintainer
Created by

🇨🇦Canada ambient.impact Toronto

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

Comments & Activities

Production build 0.71.5 2024