Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SCSS: String contents can be changed in nested interpolations #2734

Open
lydell opened this issue Sep 3, 2017 · 1 comment
Open

SCSS: String contents can be changed in nested interpolations #2734

lydell opened this issue Sep 3, 2017 · 1 comment
Labels
lang:css/scss/less Issues affecting CSS, Less or SCSS scope:dependency Issues that cannot be solved inside Prettier itself, and must be fixed in a dependency type:bug Issues identifying ugly output, or a defect in the program

Comments

@lydell
Copy link
Member

lydell commented Sep 3, 2017

a {
  k: "#{".5"}";
}

is turned into:

a {
  k: "#{"0.5"}";
}

Playground

Expected: The inner string, ".5", should stay unchanged.

This happens because postcss-values-parser does not support interpolations in strings, so it sees the property value as the string "#{" followed by the number .5 followed by the string "}". shellscape/postcss-values-parser#37

@lydell lydell added type:bug Issues identifying ugly output, or a defect in the program lang:css/scss/less Issues affecting CSS, Less or SCSS scope:dependency Issues that cannot be solved inside Prettier itself, and must be fixed in a dependency labels Sep 3, 2017
@alexander-akait
Copy link
Member

Also:

a {
  k: "#{".5  +  .5"}";
}

is turned into:

a {
  k: "#{"0.5 + 0.5"}";
}

Remove spaces around +, but it is not operator, it is part of string

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lang:css/scss/less Issues affecting CSS, Less or SCSS scope:dependency Issues that cannot be solved inside Prettier itself, and must be fixed in a dependency type:bug Issues identifying ugly output, or a defect in the program
Projects
None yet
Development

No branches or pull requests

2 participants