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.

New comment polluting compiled CSS output

See original GitHub issue

Package

@carbon/type

Browser

No response

Package version

10.35.0

Description

As part of PR #9480, comments like the following have been added to some SCSS files: image

The problem is that this style of comment, /* ... */, in sass means that the comment is preserved into the CSS output, meaning that the output CSS from our builds now contains many hundreds of copies of this comment and have become substantially larger as a result. These comments only apply at build/lint time and do not need to be preserved into the CSS output. They should be changed to // ... style comments, which are discarded during sass compile.

@tw15egan @joshblack FYI

CodeSandbox example

no

Steps to reproduce

n/a

Code of Conduct

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
dcwarwickcommented, Sep 17, 2021

Agreed – bloat to the non-minimised built CSS is unfortunate but not otherwise a major issue in itself. I think I was more concerned that these comments simply do not belong in the generated output, so it’s a mistake, albeit an ultimately harmless one. I probably shouldn’t have used the “bug” tag, just a dev issue.

Our tests showed up the issue, but once we’ve regenerated the snapshots they continue to pass – although we do have one test that checks that a whole set of “definitions-only” SCSS generates no actual CSS output, and I have had to modify that test because although it still generates no actual CSS it does now generate some comments! I fixed that test by switching to use a minified CSS compile for the test, which does indeed slow the test down slightly. Not a big problem, though, and no ultimate impact on any production use cases.

0reactions
joshblackcommented, Sep 15, 2021

@dcwarwick great point on the codebase, I’ll definitely look into it and see 👀 thanks for pointing that out.

What are you seeing in terms of the impact of the size for uncompressed output? It seems like you’re using it for tests, is it that the tests are now slower, or is some other factor coming into play? In general, size of uncompressed output is not something we generally consider a bug but if you’re noticing something negative that is impacting a production use-case or a common use-case I’d love to know about it so we can make sure we consider it in our work 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

sass - Which output styles remove multiline line comments?
With :nested and :expanded, all multi-line comments and their line breaks are rendered in the final CSS. For example, this SCSS: // SL...
Read more >
Comments - Sass
Both syntaxes support two types of comments: comments defined using /* */ that are (usually) compiled to CSS, and comments defined using //...
Read more >
A Thorough Analysis of CSS-in-JS
Wondering what's even more challenging than choosing a JavaScript framework? You guessed it: choosing a CSS-in-JS solution. Why?
Read more >
Preserving CSS Comments For Wordpress During Sass ...
To compress using Compass, simply run compass compile -s compressed to strip out all comments and other unnecessary content.
Read more >
How to Add Comments in CSS for Yourself or Your Developer
To comment in CSS, simply place your plain text inside /* */ marks. This tells the browser that they are notes and should...
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