Skip to content

Add support for maps with numeric keys#81

Merged
PlentyCodeDev merged 1 commit into
plentycode:masterfrom
davidsmith2:maps-with-numeric-keys
Jun 23, 2022
Merged

Add support for maps with numeric keys#81
PlentyCodeDev merged 1 commit into
plentycode:masterfrom
davidsmith2:maps-with-numeric-keys

Conversation

@davidsmith2
Copy link
Copy Markdown
Contributor

@davidsmith2 davidsmith2 commented Jun 19, 2022

This PR adds support for Sass Maps that have numeric keys. It does this by updating the sass-export parser to allow a digit to appear as the first character in map keys--this appears to be valid Sass, as the following Gist shows:

https://gist.github.com/davidsmith2/99d0ce1a7017690844e2adf80300b7aa

Resolves #74

Comment thread src/app/utils/utils.ts
public static wrapCss(cssDeclaration: IDeclaration, useInspect: boolean): string {
if (useInspect) {
return `${WRAPPER_CSS_ID}.${cssDeclaration.name}{content:"#{inspect(${cssDeclaration.value})}";}`;
return `${WRAPPER_CSS_ID}._${cssDeclaration.name}{content:"#{inspect(${cssDeclaration.value})}";}`;
Copy link
Copy Markdown
Contributor Author

@davidsmith2 davidsmith2 Jun 20, 2022

Choose a reason for hiding this comment

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

The underscore is required to avoid errors like the following:

Error: Expected identifier.
   ╷
46 │ #sass-export-id.100{content:"#{inspect(80%)}";}
   │                 ^
   ╵

Copy link
Copy Markdown
Member

@PlentyCodeDev PlentyCodeDev left a comment

Choose a reason for hiding this comment

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

looks great, thank you! 🚀

@PlentyCodeDev PlentyCodeDev merged commit 7bc1330 into plentycode:master Jun 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Errors reporting that maps aren't valid CSS values

2 participants