← 输入框|github.com|刷新
Skip to content

fix(global): add scss var for global image path - #8400

Merged
kmcfaul merged 1 commit into
patternfly:mainfrom
mcoker:issue-8398
May 14, 2026
Merged

kmcfaul merged 1 commit into
patternfly:mainfrom
mcoker:issue-8398

Conversation

@mcoker

@mcoker mcoker commented May 14, 2026 •

Copy link
Copy Markdown
Contributor

fixes #8398

Summary by CodeRabbit

Release Notes

  • Refactor
    • Enhanced the styling system's background image path configuration to be more flexible and centralized, allowing easier customization and asset relocation across multiple theme variants.

Review Change Stack

@mcoker
mcoker requested a review from jcmill May 14, 2026 14:44
@coderabbitai

coderabbitai Bot commented May 14, 2026 •

Copy link
Copy Markdown
Contributor

Walkthrough

This PR fixes incorrect relative URL paths in glass and felt-glass theme SCSS token files by introducing a configurable global image path variable and updating five token files to use variable interpolation instead of hard-coded paths.

Changes

Glass/Felt-Glass Theme Background Image Resolution

Layer / File(s) Summary
Global image path variable definition
src/patternfly/sass-utilities/scss-variables.scss
Introduces $pf-v6-global--image-path SCSS variable with default value ./assets/images, enabling configurable SVG asset path resolution across token files.
Token file image path resolution updates
src/patternfly/base/tokens/tokens-local.scss, src/patternfly/base/tokens/tokens-local-felt-glass-dark.scss, src/patternfly/base/tokens/tokens-local-felt-glass.scss, src/patternfly/base/tokens/tokens-local-glass-dark.scss, src/patternfly/base/tokens/tokens-local-glass.scss
All five token files update their Sass utilities import path to ../../sass-utilities/ and use #{$pf-v6-global--image-path} interpolation in CSS custom property values to reference background image SVGs, replacing hard-coded ./assets/images/ relative paths.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • patternfly/patternfly#8356: Modifies the same theme token mixins in glass/felt token files, adjusting --pf-t--global--background--image--default SVG URL sourcing with a different approach.
  • patternfly/patternfly#8319: Updates glass/felt default background-image URLs to the same PF-Bkg-Generic-*.svg and Felt-Bkg-Generic-*.svg assets.

Suggested labels

released on @prerelease``

Suggested reviewers

  • jcmill
  • lboehling
  • srambach
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title follows conventional commit guidelines with a proper type prefix (fix), scope (global), and descriptive message.
Linked Issues check ✅ Passed The PR successfully addresses issue #8398 by adding a configurable SCSS variable for the global image path and updating all affected token files to use it instead of hard-coded relative paths.
Out of Scope Changes check ✅ Passed All changes are directly related to resolving issue #8398: importing Sass utilities correctly and updating four token files plus the scss-variables file to fix image path resolution.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@patternfly-build

patternfly-build commented May 14, 2026 •

Copy link
Copy Markdown
Collaborator

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/patternfly/sass-utilities/scss-variables.scss`:
- Around line 28-29: The default image path variable $pf-v6-global--image-path
currently uses "./assets/images" which can resolve incorrectly for token
consumers; change its default value to "../assets/images" (preserving the
!default flag) so the variable reads $pf-v6-global--image-path:
"../assets/images" !default; to correct resolution for consuming token files.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 54706f18-41e9-4ff2-b302-a7e9eac16c49

📥 Commits

Reviewing files that changed from the base of the PR and between e0a0da7 and 6cef15c.

📒 Files selected for processing (6)
  • src/patternfly/base/tokens/tokens-local-felt-glass-dark.scss
  • src/patternfly/base/tokens/tokens-local-felt-glass.scss
  • src/patternfly/base/tokens/tokens-local-glass-dark.scss
  • src/patternfly/base/tokens/tokens-local-glass.scss
  • src/patternfly/base/tokens/tokens-local.scss
  • src/patternfly/sass-utilities/scss-variables.scss

Comment on lines +28 to +29
// Image path
$pf-v6-global--image-path: "./assets/images" !default;

@coderabbitai coderabbitai Bot May 14, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Default image path still points to the wrong location for token consumers.

Line 29 keeps ./assets/images as default, which can still resolve to base/tokens/assets/images from the affected token files. That means the original webpack resolution failure can persist unless consumers override this variable.

Proposed fix
 // Image path
-$pf-v6-global--image-path: "./assets/images" !default;
+$pf-v6-global--image-path: "../../assets/images" !default;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// Image path
$pf-v6-global--image-path: "./assets/images" !default;
// Image path
$pf-v6-global--image-path: "../../assets/images" !default;
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/patternfly/sass-utilities/scss-variables.scss` around lines 28 - 29, The
default image path variable $pf-v6-global--image-path currently uses
"./assets/images" which can resolve incorrectly for token consumers; change its
default value to "../assets/images" (preserving the !default flag) so the
variable reads $pf-v6-global--image-path: "../assets/images" !default; to
correct resolution for consuming token files.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When folks use patternfly, they import @patternfly/patternfly/patternfly.css, and in that package is a ./assets/image directory that correctly resolves the image paths.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mcoker, thank you for the clarification! You're right — the ./assets/images default is intentionally consistent with how the other existing asset path variables are defined in this file (e.g., $pf-v6-global--font-path: "./assets/fonts" and $pf-v6-global--fonticon-path: "./assets/pficon"), and it correctly resolves for the standard consumption pattern against the package root.

The real fix here is the change from hard-coded url("./assets/images/...") in the individual token files to url("#{$pf-v6-global--image-path}/..."), which makes the path configurable for any SCSS-source consumers who may have a different setup. My concern about the default value was incorrect. Thanks for explaining the consumption model!


✏️ Learnings added
Learnt from: mcoker
Repo: patternfly/patternfly PR: 8400
File: src/patternfly/sass-utilities/scss-variables.scss:28-29
Timestamp: 2026-05-14T15:00:48.613Z
Learning: In the PatternFly (patternfly/patternfly) project, the `$pf-v6-global--image-path` SCSS variable (in `src/patternfly/sass-utilities/scss-variables.scss`) intentionally uses `"./assets/images"` as its default value, consistent with other asset path variables like `$pf-v6-global--font-path: "./assets/fonts"`. Consumers typically import `patternfly/patternfly/patternfly.css` (pre-compiled), and the `./assets/images` directory exists at the package root, so the default resolves correctly. The `!default` flag allows SCSS-source consumers to override as needed.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

@jcmill jcmill left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💪👍

@kmcfaul
kmcfaul merged commit d47bf8b into patternfly:main May 14, 2026
5 checks passed
@patternfly-build

Copy link
Copy Markdown
Collaborator

🎉 This PR is included in version 6.5.0-prerelease.92 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug - [Tokens] - Glass theme SCSS token files have incorrect relative url() paths to SVG assets

4 participants