question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Mangling comments in scss

See original GitHub issue

This is the smallest example I could create

before:

$colors: (
light: #fff,
);
//
//

after:

$colors: (
	light: #fff
);
li
);

Empty comments are removed and replaced with garbage pulled from elsewhere in the file.

I first saw this happening with a much larger file with a much longer defintion of $colors followed by a block of comments (// not /* */) which had multiple empty comment lines for paragraph spacing. The formatter a) replaced a couple empty comment lines with a pair of characters from a different line (as above) and b) removed others leaving an empty line. After removing the erroring characters, subsequent format would then remove those empty lines (also undesired behavior) clumping the comment paragraphs into a single block.

I’ve looked for a setting to disable formatting of any comments but I couldn’t find any.

I’m happy to move this issue to https://github.com/prettier/prettier if that’s a better place.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
johndugancommented, Aug 10, 2018

Related - ignore rules are not obeyed.

Before formatting:

/* prettier-ignore-start */
$mq-footer_row3: em(700);            // [1]
$mq-promoBrandsList-medium: em(550); // [2]
$mq-promoBrandsList-large: em(930);  // [3]
$mq-promo4coloumn: em(450);          // [4]
/* prettier-ignore-end */

After formatting:

/* prettier-ignore-start */
$mq-footer_row3: em(700); // [1]
$mq-promoBrandsList-medium: em(550); // [2]
$mq-promoBrandsList-large: em(930); // [3]
$mq-promo4coloumn: em(450); // [4]
/* prettier-ignore-end */

0reactions
github-actions[bot]commented, Apr 12, 2020

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Comments
If a multi-line comment is written somewhere that a statement is allowed, it's compiled to a CSS comment. They're also called loud comment,...
Read more >
Webpack is mangling my .scss stylesheet classes
1 Answer 1 · So, my main problem with the solution in your comments is that it removes the built-in styles for the...
Read more >
CSS Class Mangling/Obfuscation : r/Angular2
CSS Class Mangling/Obfuscation. Does anyone know how this can be achieved via angular-cli? It's something that an increasing number of sites ...
Read more >
Sass vs. Less
Sass has actual logical and looping operators in the language. if/then/else statements, for loops, while loops, and each loops.
Read more >
Using Comments in Sass
From the Sass file, we can even use interpolation within multiline-comments, which means that we can insert variable values inside a multiline- ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found