Skip to content

refactor: reduce CSS Custom Properties#6264

Closed
mfranzke wants to merge 19 commits intomainfrom
refactor-clean-up-css-custom-properties
Closed

refactor: reduce CSS Custom Properties#6264
mfranzke wants to merge 19 commits intomainfrom
refactor-clean-up-css-custom-properties

Conversation

@mfranzke
Copy link
Copy Markdown
Collaborator

@mfranzke mfranzke commented Mar 8, 2026

Proposed changes

We need to identify ways of how to reduce the amount of CSS Custom Variables and related @property declarations, only to the ones that are necessarily to get included.

  • Removed custom font family properties for sans and head, as those are already forwarded from packages/foundations/scss/defaults/_default-properties.scss
  • Removed whitelabel default-theme from CSS, as we might want to provide this as a separate file, but it's most likely unnecessary in our DB context (and even for others as most of them would be using a theme).
  • Added CSS Custom Properties delta in between Core Foundations and DB Theme packages to packages/foundations/scss/defaults/default-theme.scss

Types of changes

  • Bugfix (non-breaking change that fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Refactoring (improvements to existing components or architectural decisions)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update (if none of the other choices apply)

Further comments

🔭🐙🐈 Test this branch here: https://design-system.deutschebahn.com/core-web/review/refactor-clean-up-css-custom-properties

Removed custom font family properties for sans and head, as those are already forwarded from `packages/foundations/scss/defaults/_default-properties.scss`
@mfranzke mfranzke self-assigned this Mar 8, 2026
@mfranzke mfranzke added the 🍄🆙improvement New feature or request label Mar 8, 2026
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 8, 2026

⚠️ No Changeset found

Latest commit: d54372d

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

We might provide this as a seperate whitelabel default-theme CSS, but remove it in total as a simplification for current testing.
github-actions bot and others added 3 commits March 8, 2026 08:09
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@mfranzke mfranzke changed the title refactor: clean-up CSS Custom Properties refactor: reduce CSS Custom Properties Mar 8, 2026
@mfranzke mfranzke requested a review from Copilot March 8, 2026 16:43
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors the CSS Custom Properties setup in the DB UX Design System's core foundations package to reduce the number of CSS Custom Variables and @property declarations in bundled outputs. It removes the whitelabel default theme from bundled CSS entry points and cleans up redundant font-family property declarations.

Changes:

  • Removed @forward "defaults/default-theme" from relative.scss, so bundled CSS files (relative.css, absolute.css, rollup.css, webpack.css) no longer include the default theme (it remains available as a standalone default-theme.css import)
  • Removed duplicate --db-font-family-sans and --db-font-family-head @property declarations from default-theme.scss (already defined in the forwarded _default-properties.scss)
  • Added CSS Custom Properties for container sizes and screen breakpoints as a delta between Core Foundations and DB Theme packages in default-theme.scss

Reviewed changes

Copilot reviewed 2 out of 6 changed files in this pull request and generated 3 comments.

File Description
packages/foundations/scss/relative.scss Removed the forward of default-theme from bundled CSS entry point
packages/foundations/scss/defaults/default-theme.scss Removed redundant font-family properties; added container and screen size @property declarations
__snapshots__/tooltip/showcase/chromium-highContrast/... Updated visual regression screenshot reflecting CSS changes

Comment on lines +59 to +81
@property --db-screen-md {
syntax: "*";
inherits: true;
initial-value: 64em;
}

@property --db-screen-sm {
syntax: "*";
inherits: true;
initial-value: 48em;
}

@property --db-screen-xl {
syntax: "*";
inherits: true;
initial-value: 120em;
}

@property --db-screen-xs {
syntax: "*";
inherits: true;
initial-value: 20em;
}
Copy link

Copilot AI Mar 8, 2026

Choose a reason for hiding this comment

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

The new --db-screen-* @property declarations are missing --db-screen-lg. The SCSS variable $db-screen-lg: var(--db-screen-lg) is defined in _variables.scss (line 97), and it's also referenced in tailwind/theme/_variables.scss (line 32), but no @property --db-screen-lg is declared here or anywhere else. Since you're adding screen property declarations in this file, --db-screen-lg should be included as well (with initial-value: 90em, i.e. px-to-em(1440)).

Copilot uses AI. Check for mistakes.
github-actions bot and others added 2 commits March 8, 2026 17:59
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@github-actions github-actions bot added the 📕documentation Improvements or additions to documentation label Mar 8, 2026
@github-actions github-actions bot removed the 📕documentation Improvements or additions to documentation label Mar 8, 2026
github-actions bot and others added 2 commits March 9, 2026 19:14
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@mfranzke
Copy link
Copy Markdown
Collaborator Author

closed in favour of #6308

@mfranzke mfranzke closed this Mar 13, 2026
@github-project-automation github-project-automation bot moved this from 🏗 In progress to ✅ Done in UX Engineering Team Backlog Mar 13, 2026
@mfranzke mfranzke deleted the refactor-clean-up-css-custom-properties branch March 13, 2026 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

2 participants