cssunminifier icon indicating copy to clipboard operation
cssunminifier copied to clipboard

Unminifying a CSS rule that has a width or max-width as the last style (without a semi-colon) fails

Open fuad-tareq opened this issue 1 year ago • 0 comments

This was part of the result of un-minifying a stylesheet:

.pnd-img {
    width: auto;
    height: auto;
    position: relative;
    max-width: 100%}

Whereas the expected result is:

.pnd-img {
    width: auto;
    height: auto;
    position: relative;
    max-width: 100%;
}

Your (awesome!) tool manages to handle adding the missing semi-colons in seemingly all other scenarios except when the last style/property is a width, min-width, or a height. This is also an issue when the only style in the defined rule is a width, min-width, or a height.

Note 1: I've only tried this on: https://mrcoles.com/blog/css-unminify/

Note 2: Oddly enough, this wasn't always the case (but it did fail this about 80% of the time).

Note 3: I'm starting to wonder if maybe the % sign at the end is the problem. Because there were also odd cases of it failing when the last style was a left: 0%, margin-bottom: 5%, flex-basis: 50%, etc. The only exception to this has been one rule that ended with a content: "/".

Note 4: It also failed to add a new line after the closing bracket of a media query.

fuad-tareq avatar Apr 04 '23 20:04 fuad-tareq