premailer / css_parser

Ruby CSS Parser
Other
279 stars 110 forks source link

keep border-width when border-color has spaces #130

Closed dorianmariecom closed 2 years ago

dorianmariecom commented 2 years ago

When having border-width: 1px and border-color: black but no border-style it would combine to an invalid, see https://codepen.io/dorianmariefr/pen/qBPqLZM for instance

Now it doesn't combine the properties if the three (width/color/style) are not present

Context

I encountered this when doing @apply border border-black in tailwindcss and having it compiled by premailer for my emails, the border would not appear

Pre-Merge Checklist

dorianmariecom commented 2 years ago

actually found the fix, it's because it was deleting properties then returning early

I guess it should combine the properties still but I don't know enough css to know why the

return nil if declaration.value.gsub(/,\s/, ',').strip =~ /\s/

is in place

grosser commented 2 years ago

looks good! :) can you fix up what rubocop is complaining ?

dorianmariecom commented 2 years ago

thanks, I refactored a bit so that rubocop doesn't think there are two times the same loop

grosser commented 2 years ago

1.11.0

dorianmariecom commented 2 years ago

cool!