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.

Spaces and line breaks around `var` calls are not removed

See original GitHub issue

Explanation

Hi @jakubpawlowicz, ran into issue that when there are spaces/linebreaks in var calls in CSS code, minifier does not remove them. That shouldn’t be it, right?

Precheck

  • Do a quick search and make sure a bug has not yet been reported; 👍
  • do a quick check if the bug still exists in the latest patch version; 👍
  • finally, be nice and have fun! 👍

Environment

  • clean-css version - npm ls clean-css: 5.3.2
  • node.js version - node -v: 12.14.0
  • operating system: Ubuntu 20.04

Configuration options

var CleanCSS = require('clean-css');
new CleanCSS({
  level: 2,
})

Input CSS

.alert--primary{--ifm-alert-background-color:var(
        --ifm-color-primary-contrast-background
      );--ifm-alert-background-color-highlight:rgba(53, 120, 229, 0.15);--ifm-alert-foreground-color:var(
        --ifm-color-primary-contrast-foreground
      );--ifm-alert-border-color:var(--ifm-color-primary-dark)}

Actual output CSS

.alert--primary{--ifm-alert-background-color:var(
        --ifm-color-primary-contrast-background
      );--ifm-alert-background-color-highlight:rgba(53, 120, 229, 0.15);--ifm-alert-foreground-color:var(
        --ifm-color-primary-contrast-foreground
      );--ifm-alert-border-color:var(--ifm-color-primary-dark)}

Expected output CSS

.alert--primary{--ifm-alert-background-color:var(--ifm-color-primary-contrast-background);--ifm-alert-background-color-highlight:rgba(53, 120, 229, 0.15);--ifm-alert-foreground-color:var(--ifm-color-primary-contrast-foreground);--ifm-alert-border-color:var(--ifm-color-primary-dark)}

image

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
jakubpawlowiczcommented, Aug 5, 2021

@lex111 thanks for checking and figuring out how to do it with yarn. Noted, should be useful in the future. 5.1.5 will be out later today.

1reaction
jakubpawlowiczcommented, Aug 3, 2021

Hey @lex111 - that shouldn’t be it indeed. Let’s fix it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to remove all line breaks from a string - Stack Overflow
(Probably you do not want to remove the newlines, but replace them with other whitespace, for example the space character, so that words...
Read more >
White-space handling - Apache FreeMarker Manual
Indentation white-space, and trailing white-space at the end of the line (includes the line break) will be ignored in lines that contains only ......
Read more >
How whitespace is handled by HTML, CSS, and in the DOM
Whitespace is any string of text composed only of spaces, tabs or line breaks (to be precise, CRLF sequences, carriage returns or line ......
Read more >
Formatting - Coding Style - Read the Docs
Remove it if you're already changing that line, or do it in a separate clean-up operation(preferably when no-one else is working on the...
Read more >
Rules - ESLint - Pluggable JavaScript Linter
Disallow `this`/`super` before calling `super()` in constructors ... no-delete-var ... Require or disallow newlines around variable declarations.
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