Fix dynamic style switching when CSS are optimized in D10

Created on 14 November 2023, about 1 year ago
Updated 18 November 2023, about 1 year ago

Problem/Motivation

In Drupal 10 when CSS are optimized "dynamic" style switching doesn't work, you can see a style applied only after a page refresh or after opening another page.

Steps to reproduce

  1. Install a fresh D10 site. Reproduced in D10.0.0 and in D10.1.6 on PHP 8.1
  2. composer require 'drupal/styleswitcher:2.x-dev@dev'
  3. Enable the module, add any custom style on configuration page
  4. Add Style Switcher block(s) to theme(s)
  5. Click the new style in block

Proposed resolution

Remaining tasks

None

User interface changes

None

API changes

  • Removed #pre_render callback from the html_tag element.
  • Replaced the custom media property with the id attribute in the dynamic-css library definition.

Data model changes

None

πŸ› Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡¦Ukraine pingwin4eg Zaporizhia πŸ‡ΊπŸ‡¦

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

Comments & Activities

Production build 0.71.5 2024