Repository navigation
fix(global): add scss var for global image path - #8400
Conversation
WalkthroughThis 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. ChangesGlass/Felt-Glass Theme Background Image Resolution
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ 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. Comment |
|
Preview: https://pf-pr-8400.surge.sh A11y report: https://pf-pr-8400-a11y.surge.sh |
There was a problem hiding this comment.
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
📒 Files selected for processing (6)
src/patternfly/base/tokens/tokens-local-felt-glass-dark.scsssrc/patternfly/base/tokens/tokens-local-felt-glass.scsssrc/patternfly/base/tokens/tokens-local-glass-dark.scsssrc/patternfly/base/tokens/tokens-local-glass.scsssrc/patternfly/base/tokens/tokens-local.scsssrc/patternfly/sass-utilities/scss-variables.scss
| // Image path | ||
| $pf-v6-global--image-path: "./assets/images" !default; |
There was a problem hiding this comment.
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.
| // 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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
@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.
|
🎉 This PR is included in version 6.5.0-prerelease.92 🎉 The release is available on: Your semantic-release bot 📦🚀 |
fixes #8398
Summary by CodeRabbit
Release Notes