-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrect CSS shorthand optimization. #162
Comments
You need to check what's the version of cssnano you 're using; I think you hit this bug: cssnano/cssnano#1051 It was fixed on [email protected] by cssnano/cssnano#1057 |
Sorry for the delay - somehow I did not get notified of your reply. My project was set up using I guess that I should contact the creators of |
I've tried using |
@thewaver, another WA is to add this rule in the webpack config file in the mini-css-webpack-plugin configuration:
However, , I see 5.0.7 is already on package-lock.json https://raw.githubusercontent.com/facebook/create-react-app/main/package-lock.json |
Sorry for the late reply. Somehow GH doesn't notify me of responses. Will have to sort that out at some point. I don't have access to webpack - I guess I need to eject for that. Haven't done it before, but I suppose that I can figure it out. What I can't figure out is that I just created a new project using CRA, checked that all packages inside I am using the typescript template, in case that bares any relevance at all. Not really sure what other info I can provide. |
Preface
First of all, I'd like to apologize if this issue is not related to this package. I came here from create-react-app itself. Please redirect me to the proper package if it isn't. I am not particularly knowledgeable when it comes to packages and setup.
Describe the bug
When creating an optimized build (
npm run build
) I get erroneous CSS optimization (I assume "something" is optimizing incorrectly, but I have no idea what). This does not reproduce when simply running locally throughnpm start
.This is the CSS in question:
it gets optimized into:
which may seem correct at first, except
border-width
can be a set of values for the different "sides" of the border, and that does not work with the shorthand. (border: 20px 0 30px 0 solid red
is not valid, for instance). So the properties should not be getting aggregated. At least as far as my understanding goes.Environment
current version of create-react-app: 4.0.3
System:
OS: Windows 10 10.0.19042
CPU: (8) ia32 Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz
Binaries:
Node: 14.17.0 - C:\Program Files (x86)\nodejs\node.EXE
Yarn: Not Found
npm: 7.16.0 - C:\Program Files (x86)\nodejs\npm.CMD
Browsers:
Chrome: 91.0.4472.77
Edge: Spartan (44.19041.964.0), Chromium (91.0.864.41)
Internet Explorer: Not Found
npmPackages:
react: ^17.0.2 => 17.0.2
react-dom: ^17.0.2 => 17.0.2
react-scripts: 4.0.3 => 4.0.3
npmGlobalPackages:
create-react-app: Not Found
Steps to reproduce
In "description". Essentially:
border-width
andborder-color
.border-width
to represent multiple "sides" (10px 20px 0 30px
).npm start
. Observe correct CSS.npm run build && serve -s build
. Observe incorrect CSS.For brevity, here's how to do step 2:
Reproducible demo
You can find my published, erroneously optimized page here:
https://protos.now.sh
Use MINIMAL as the "theme style", then inspect any "input" and you'll see the CSS is incorrect.
The text was updated successfully, but these errors were encountered: