stylefmt icon indicating copy to clipboard operation
stylefmt copied to clipboard

Unnecessary Change Breaks CSS

Open Braden1996 opened this issue 8 years ago • 7 comments

I am having issues making this compatible with Lost.

The following property:

div {
    lost-column: 1/2;
}

... is being formatted to:

div {
    lost-column: 1 / 2;
}

Stylelint doesn't seem to throw any errors about this format, so why is stylefmt attempting to correct it?

Braden1996 avatar Aug 29 '16 14:08 Braden1996

@Braden1996 It's the default formatting rules of stylefmt. Is formatted code not be able to run with Lost?

matype avatar Aug 30 '16 04:08 matype

Well, lost-column has optional arguments which are space-separated. So, it seems to be passing three arguments (1, / and 2) instead of just the one fraction argument (1/2).

Braden1996 avatar Aug 30 '16 08:08 Braden1996

it even worst as it breaks SCSS variables names, like: padding-bottom: $ratio-4-3; into wrong: padding-bottom: $ratio-4 - 3;

stylelint have no problem with this line, why change it?

tinovyatkin avatar Sep 12 '16 19:09 tinovyatkin

I would love to see this issue fixed! It makes it hard to use stylefmt and lost.

pattiereaves avatar Jun 22 '17 19:06 pattiereaves

@pattiereaves Great! Please feel free to send your PR :)

matype avatar Jun 23 '17 02:06 matype

:P well played @morishitter

pattiereaves avatar Jun 23 '17 15:06 pattiereaves

Is #70 related?

There's some comments removed in that change, which say

// don't format minus sign (-) before a number
// because we don't know if it is
// part of a Sass variable name (e.g. $my-var-1-2).

palashkaria avatar Aug 18 '17 22:08 palashkaria