Css aggregation should exclude assets with attributes from preprocessing

Created on 23 August 2020, almost 5 years ago
Updated 20 August 2023, almost 2 years 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

Needs review

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.

  • last update almost 2 years 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 almost 2 years 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 almost 2 years ago
    Build Successful
  • First commit to issue fork.
  • Status changed to Postponed: needs info over 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?

  • Status changed to Closed: cannot reproduce 17 days ago
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Since there's been no follow up going to close out, if still an issue in D11 please re-open.

Production build 0.71.5 2024