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.

CSS get bundled which breaks with custom properties

See original GitHub issue

With react-scripts build some css longhand properties get merged to a shorthand. This is not always the desired result and is breaking with css custom properties.

It would be nice if we could disable some compression options on a react build via a config. Example also with the calc minification from css nano

Or this behavior gets fixed.

Input:

.some-class {
    border-width: var(--border-width, 0 0 1px);
    border-style: var(--border-style, solid);
    border-color: var(--border-color, #eee);
}

Becomes this:

.some-class {
    border:
        var(--border-width, 0 0 1px)
        var(--border-style, solid)
        var(--border-color, #eee);
}

Expected:

.some-class {
    border: var(--border-style, solid) var(--border-color, #eee);
    border-width: var(--border-width, 0 0 1px);
}

Environment Info:

System: OS: macOS 10.14.6 CPU: (4) x64 Intel® Core™ i5-3210M CPU @ 2.50GHz Binaries: Node: 10.16.0 - /usr/local/opt/node@10/bin/node Yarn: 1.17.0 - /usr/local/bin/yarn npm: 6.9.0 - /usr/local/opt/node@10/bin/npm Browsers: Chrome: 78.0.3904.34 Firefox: Not Found Safari: 13.0.1 npmPackages: react: ^16.9.0 => 16.9.0 react-dom: ^16.9.0 => 16.9.0 react-scripts: ^3.1.1 => 3.1.1 npmGlobalPackages: create-react-app: 3.0.1

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
sidonaldsoncommented, Dec 6, 2019

I’ve added a PR to cure my specific issue but not to allow any overrides to be passed through https://github.com/facebook/create-react-app/pull/8106

1reaction
sidonaldsoncommented, Oct 30, 2019

I’m facing a similar issue too. Would be good to be able to override the nano defaults. In my case they are minifying the font-face declaration which then breaks fonts in IE11

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using CSS custom properties (variables) - MDN Web Docs
Custom properties (sometimes referred to as CSS variables or cascading variables) are entities defined by CSS authors that contain specific ...
Read more >
Understanding CSS Custom Properties | Ultimate Guide
Let's look at how handy it is to break down legitimate CSS values into pieces that can be stuffed into custom properties. A...
Read more >
Bundling less and css files together
Try using a generic Bundle as I do in my config, like this: var customStyles = new Bundle("~/bundle/style/css") .
Read more >
css-vars-ponyfill - GitHub Pages
Get the CSS content (including @import rules) · Parse the CSS and convert it to an AST · Parse custom property declarations from...
Read more >
Improve your CSS by organizing your properties - YouTube
Also, at the end of the day, the method you use to organize your properties doesn't really matter, but having a method will...
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