[WC-3392] Fix duplicate color variant imports in Atlas Core - #327
Open
rahmanunver wants to merge 3 commits into
Open
[WC-3392] Fix duplicate color variant imports in Atlas Core#327rahmanunver wants to merge 3 commits into
rahmanunver wants to merge 3 commits into
Conversation
The pre-commit hook reformats this file wholesale on any edit, since it was previously committed with 2-space indentation. Isolating that churn here keeps the follow-up fix reviewable. Whitespace only, plus two hex literals lowercased by prettier (#EA3337, #B8BABF). Compiled CSS is unaffected.
theme/web/custom-variables.scss imported back into themesource/atlas_core/web/variables, forming a core -> theme -> core round trip. Combined with main.scss importing color-variants directly, the output of color-variants was emitted three times in atlas_core.css. Move the variables import from custom-variables.scss up to theme/web/main.scss, drop the now redundant color-variants import from atlas_core/web/main.scss, and add !default to $brand-colors and $lightness-steps so a future re-import cannot clobber downstream overrides. Reduces atlas_core.css by 35005 bytes (4.2%). The theme and web_content bundles compile byte-identical.
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
| @import "custom-variables"; | ||
| // Sass variables for theme authors. Must come after custom-variables so that | ||
| // $use-css-variables is already set when variables reads it. | ||
| @import "../../themesource/atlas_core/web/variables"; |
Contributor
There was a problem hiding this comment.
why is this here?
and why is it using ../../. to access the variables that it's own modules have?
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. Its output is a single 16,987-byte:rootblock, so the file carried ~34 KB of byte-identical duplication (compiled output lines 481 / 859 / 1269).Cause: a
core -> theme -> coreimport round trip, and legacy@importnever dedupes.custom-variables.scsslives intheme/— it is the app author's customization template. It importing back down intothemesource/atlas_core/is what closes the loop.Solution
custom-variables.scss:603.theme/web/main.scss, where theme authors legitimately need the Sass variables. Placed aftercustom-variablesso$use-css-variablesis set beforevariablesreads it.@import "color-variants"fromatlas_core/web/main.scss;@import "variables"already pulls it in.!defaultto$brand-colorsand$lightness-stepsso a future re-import cannot clobber a downstream override.Net:
9 insertions, 4 deletions.Result
atlas_core.csstheme_web.cssatlas_web_content.cssatlas_core.css−35,005 B (−4.2%). The other two bundles compile byte-identical.validateSasspasses.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). Review the second commit for the actual fix.