CssOptimizer should leave url('#hash') alone

Created on 1 November 2021, over 2 years ago
Updated 6 August 2023, 11 months ago

Problem/Motivation

\Drupal\Core\Asset\CssOptimizer anchors all paths in the CSS with its base url. Aside of ignoring external and absolute paths, it should also ignore paths starting with a hash (#).

Steps to reproduce

Add urls in a CSS file which contains a hash sign, for example:




.blur {
  filter: url(my-file.svg#svg-blur); /* the URL of an SVG file used as a filter */
}

.inline-blur {
  filter: url(#svg-blur); /* the ID of an SVG that is embedded in the HTML page */
}

Proposed resolution

Change the regex so #hash urls will be left alone. See the patch in #9.

Remaining tasks

Review the patch and commit it to core.

User interface changes

None.

API changes

None.

Data model changes

None.

Release notes snippet

None.

πŸ› Bug report
Status

Closed: duplicate

Version

11.0 πŸ”₯

Component
Asset libraryΒ  β†’

Last updated 1 day ago

No maintainer
Created by

πŸ‡³πŸ‡±Netherlands Ruuds

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.

Production build 0.69.0 2024