[node-build-scripts] fix(css-variables): preserve string quotes #5303
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.
Changes proposed in this pull request:
Before this PR, strings inside Sass lists would lose their quotes during the
generate-css-variables
build step.The following source code ...
... would become ...
This created some problems for strings containing any characters which would confuse the Sass syntax parser, such as
../
(used in file path strings, not in this repo but in another repo which uses @blueprintjs/node-build-scripts).To work around this problem and preserve the quotes for those strings, I've added some hacky logic to detect quoted strings in
generate-css-variables
, and wrap those values with quotes before writing the output tovariables.scss
.After this PR, we get:
Note that I limited the special case code added here to apply just those Sass lists which contain
,
comma delimiters. This was done to avoid acting on lists of values which make up a compound CSS property likebox-shadow
, e.g.inset 0 0 0 1px rgba($black, 0.2)
-- Sass considers those to be lists as well, but the values inside those "lists" should not be treated as strings.Reviewers should focus on:
No regressions in other parts of
lib/scss/variables.scss