-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Incorrect newlines added to CSS template literal #5886
Copy link
Copy link
Labels
area:multiparserIssues with printing one language inside another, like CSS-in-JSIssues with printing one language inside another, like CSS-in-JSlang:css/scss/lessIssues affecting CSS, Less or SCSSIssues affecting CSS, Less or SCSSlocked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.Please open a new issue and fill out the template instead of commenting.
Metadata
Metadata
Assignees
Labels
area:multiparserIssues with printing one language inside another, like CSS-in-JSIssues with printing one language inside another, like CSS-in-JSlang:css/scss/lessIssues affecting CSS, Less or SCSSIssues affecting CSS, Less or SCSSlocked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.Please open a new issue and fill out the template instead of commenting.
Prettier 1.16.4
Playground link
When using JS template literals inside the multiparser, line breaks before long template expressions can add invalid spaces/newlines to CSS.
Prettier sometimes adds a line break before the opening
${, which can change e.g.flex-direction: row-reverse;to something likeflex-direction: row -reverse.This breaks the syntax of the rendered CSS.
Input:
Output:
With the template substitution, this eventually gets inserted into the DOM as the following css:
Note the space between
columnand-reverse.Expected behavior:
...which should produce the following css: