Css aggregation should exclude assets with attributes from preprocessing

Created on 23 August 2020, about 4 years ago
Updated 20 October 2023, about 1 year ago

Problem/Motivation

If you specify the attribute "integrity" when adding a css asset, it will break the aggregation.

Steps to reproduce

Add bootstrap library to a theme

bootstrap:
  version: 4.5
  css:
    layout:
      css/bootstrap.min.css:
        {
          minified: true,
          attributes:
            {
              integrity: 'sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk',
            },
        }

Activate css aggregation: the layout breaks.
Delete attribute "integrity" and clear the cache: the layout works again.

🐛 Bug report
Status

Postponed: needs info

Version

10.1

Component
Asset library 

Last updated 1 day ago

No maintainer
Created by

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • Open in Jenkins → Open on Drupal.org →
    Environment: PHP 8.1 & MySQL 5.7
    last update about 1 year ago
    Patch Failed to Apply
  • 🇬🇧United Kingdom catch

    The integrity attribute is incompatible with aggregation. We already exclude files with attributes from aggregation for js, but the CSS logic doesn't.

  • Status changed to Needs work about 1 year ago
  • The Needs Review Queue Bot tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".

    This does not mean that the patch needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.

    Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.

  • last update about 1 year ago
    Build Successful
  • First commit to issue fork.
  • Status changed to Postponed: needs info about 1 year ago
  • 🇬🇧United Kingdom nlisgo

    I can't recreate this issue. Admittedly, I tried to make the least possible changes to trigger the bug.

    I changed core/profiles/demo_umami/themes/umami/umami.libraries.yml and changed global > css > layout > css/layout/layout.css from:

    {}

    to:

    {
      attributes: {
        integrity: 'sha384-6/QTUDnClbaDqDmY/+IdOyBdC18MXy//e1XXszrqxvbNxTf/bGFGu3kgbqK8FHRz'
      }
    }

    I install the umami profile and confirm the css/layout/layout.css is being reached and I'm not experiencing the bug on 11.x, 10.x.2, 10.x.1.

    Is there something different about the circumstances described in the steps to recreate?

Production build 0.71.5 2024