Spaces and line breaks around `var` calls are not removed
See original GitHub issueExplanation
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)}
Issue Analytics
- State:
- Created 2 years ago
- Comments:5
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@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.Hey @lex111 - that shouldn’t be it indeed. Let’s fix it.