[WC-3392] Fix duplicate color variant imports in Atlas Core - #327
Merged
Conversation
rahmanunver
force-pushed
the
fix/WC-3392_duplicate-variable-imports
branch
from
August 13, 2026 09:22
857b807 to
37f085f
Compare
gjulivan
reviewed
Aug 13, 2026
gjulivan
reviewed
Aug 14, 2026
gjulivan
reviewed
Aug 14, 2026
gjulivan
reviewed
Aug 14, 2026
The pre-commit hook reformats this file wholesale on any edit, since it was committed with 2-space indentation. Isolating that churn here keeps the accompanying change reviewable. Whitespace, plus two hex literals lowercased by prettier (#EA3337 and #B8BABF); CSS hex is case-insensitive so the compiled result is unaffected.
_color-variants.scss both defined $brand-colors, $lightness-steps and adjust-color-lightness() and emitted the :root declarations that use them. _variables.scss needed only the definitions, so it imported the whole file and re-emitted ~18 KB of CSS on every import. main.scss imports variables twice (directly, and through theme/web/custom-variables), so the block landed in atlas_core.css three times, and once more in the app's theme.compiled.css. Move the definitions to _color-variants-defaults.scss and import that from both _color-variants.scss and _variables.scss. _variables.scss now emits no CSS, so importing it repeatedly is harmless and main.scss keeps color-variants where it belongs. Also comment out the six brand color custom properties in custom-variables.scss; they duplicate themes/_theme-default.scss byte-for-byte, and every other group in that template is already commented out for users to opt into. atlas_core.css 835001 -> 800787 bytes, theme.compiled.css 22737 -> 5512.
rahmanunver
force-pushed
the
fix/WC-3392_duplicate-variable-imports
branch
from
August 14, 2026 12:19
897358c to
b841074
Compare
gjulivan
approved these changes
Aug 14, 2026
r0b1n
approved these changes
Aug 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
_color-variants.scsswas emitted three times intoatlas_core.css, and a fourth time into the app'stheme.compiled.css. Its output is a ~18 KB:rootblock plus shade classes, byte-identical on every emission (inatlas_core.cssat output lines 481 / 859 / 1269).Cause: a
core -> theme -> coreimport round trip. Legacy@importis a textual paste and never dedupes.custom-variables.scsslives intheme/— it is the app author's customization template. Reaching back down intothemesource/atlas_core/is what closed the loop, and it did so in both bundles.Solution
One line removed, at the root:
custom-variables.scss:603.@import "color-variants"fromatlas_core/web/main.scss—@import "variables"on the next line already pulls it in.!defaultto$brand-colorsand$lightness-stepsso a future re-import cannot clobber a downstream override.Nothing was relocated.
theme/web/main.scssis untouched:theme-darkandtheme-neutraluse only CSS custom properties, no Sass variables, so the theme bundle never neededvariablesat all. Legacy Sass-variable support for modules is unaffected — it still comes fromatlas_core/web/main.scss's own@import "variables".Result
atlas_core.csstheme.compiled.css(theme/web/)atlas_web_content.css~52 KB total. The removed declarations are byte-identical to the surviving copy in
atlas_core.css(verified by comparing the extracted blocks), so nothing is lost at runtime.validateSasspasses. Note it only compiles the twothemesourceentries, nottheme/web/main.scss— which is why the fourth emission went unnoticed.Note on the diff
The pre-commit hook (
pretty-quick) reformatscustom-variables.scsswholesale on any edit — it had been committed with 2-space indentation. That churn is isolated in its own commit (style: format custom-variables.scss with prettier, whitespace plus two hex literals lowercased). The actual fix is 6 changed lines across 3 files.