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

Inline comments are considered part of the value in CSS Custom Properties #2770

Closed
oscarmarcelo opened this issue Nov 2, 2019 · 1 comment

Comments

@oscarmarcelo
Copy link

I understand that custom properties have big implications in terms of the unpredictability in their values, but at least comments should be properly handled.

Tested in:

  • Dart Sass 1.23.3 (locally)
  • Dart Sass 1.18.0 (SassMeister)
  • Node Sass 4.13.0 (locally)
  • LibSass 3.5.4 (SassMeister)

Test Case

div
  --color: #fff // Comment
  --color: #fff /* Comment */

Expected

div {
  --color: #fff;
  --color: #fff; /* Comment */
}

Result

// Dart Sass
div {
  --color: #fff // Comment;
  --color: #fff /* Comment */;
}

// LibSass/Node Sass
div {
  --color: #fff;
  --color: #fff /* Comment */;
}
@nex3
Copy link
Contributor

nex3 commented Nov 2, 2019

Dart Sass's output is correct here. The CSS custom properties spec allows nearly anything in the value of the comment, and because custom property values are accessible to JS any pre-processing would make Sass no longer a CSS superset. As such, Sass-specific features are turned off in custom property values, with the sole exception of interpolation.

Note that because loud comments are a CSS construct that doesn't produce a CSS token node, we could theoretically omit those, but we generally include loud comments in CSS output anyway so I don't think that makes sense either.

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

No branches or pull requests

2 participants