MLK90
December 18, 2019, 6:08pm
1
My CSS changes when CSS minify is switched on.
Before:
background: url(’/static/img/theme/ar-64.png’) no-repeat right 1rem center, linear-gradient(to left, #fab010 3.2rem, #ffc11a 3.2rem);
After it’s cached:
background:url(/static/img/theme/ar-64.png) no-repeat 100% 1rem 50%,linear-gradient(to left,#fab010 3.2rem,#ffc11a 3.2rem);
CF is changing “right 1rem center” to “100% 1rem 50%” which causes the image ar-64.png to disappear.
Should this be happening?
sandro
December 18, 2019, 6:10pm
2
I would not think so. Can you post the URL?
intr0
December 18, 2019, 6:14pm
3
Would you mind posting a larger portion of your .css
? As it is written now, it’s not actually .css
. Thanks.
MLK90
December 18, 2019, 6:18pm
4
Sure.
https://www.moviesonprime.com/static/css/strange.css?v=1
Change the v value to see the uncached version, then refresh to see the CF minified version.
1 Like
sandro
December 18, 2019, 6:22pm
5
It seems to turn the right into a 100% and the center into 50%. I am not a CSS guru, but I also doubt that is correct.
Most likely a case for a support ticket.
1 Like
intr0
December 18, 2019, 6:25pm
6
Agree with Sandro. An appropriately minified version of your code would look something like:
a.button{background:orange;background:url(/static/img/theme/ar-64.png) no-repeat right 1rem center,linear-gradient(to left,#fab010 3.2rem,#ffc11a 3.2rem);background-size:1.2rem,100%;border-radius:.2rem;box-shadow:inset 0 -10px 10px -10px rgba(211,112,4,0.7);color:#FFF;cursor:pointer;display:inline-block;font:700 1.5rem 'Open Sans 700';margin:1rem 0;padding:.8rem 4.6rem .8rem 1.6rem;text-decoration:none;text-shadow:1px 1px #eca305;text-transform:uppercase}
MLK90
December 18, 2019, 6:26pm
7
Yeah, it’s strange.
An easy example is https://www.moviesonprime.com/static/css/strange3.css?v=1
I will report it.
intr0
December 18, 2019, 6:28pm
8
Wow. Indeed. It should instead look something like:
a.button{background:url(/static/image.png) no-repeat right 1rem center}
I’ve not used any of Cloudflare’s minification functions for quite some time due to unwanted changes. Instead I optimize / minify my .css
and .html
myself. I’d do the same with javascript but do not use any.
Zenexer
December 19, 2019, 4:54am
9
I’ve observed similar issues in the past where keywords are replaced with shorter numeric alternatives that might not work in every context. They’re always quick to fix the problem when a support ticket is opened, so definitely go that route.
That being said, I do think it’s pretty cool that they’re finding new ways to shave off bytes, even if there are glitches from time to time.
MLK90
December 19, 2019, 12:41pm
10
I found out it’s to do with the order of the CSS background properties.
The position values should come before the repeat value.
So this:
a.button{background:url(/static/image.png) no-repeat right 1rem center}
Technically, should be written like this:
a.button{background:url(/static/image.png) right 1rem center no-repeat}
Then it works fine and the CSS minify works as expected.
1 Like
system
Closed
January 17, 2020, 6:08pm
11
This topic was automatically closed after 30 days. New replies are no longer allowed.