ndparker/rcssmin

Minification breaks the calc function if using a + operator

Closed this issue · 7 comments

For example, if you do this:

body {
    width: calc(90% + 10px);
}

rcssmin will output:

body{width:calc(90%+10px)}

This breaks things, because the browser wants the spaces to stay around +. A temporary work-around, if people want it, that doesn't get the required spaces removed is a double negative:

body {
    width: calc(90% - -10px);
}

which outputs:

body{width:calc(90% - -10px)}

Thanks! I'll look into it.

N.B.: Do you have any information, which browser we're talking about? I've just read the specification, which explicitly allows using calc() without any spacing.

Ok, scratch that. Missed the relevant paragraph ;-)

This issue is still here. Any idea on when it will be fixed?

I'm actually working on it (in little timeslices, though). It's harder than it looks, because calc can be nested indefinitely, which doesn't work very well with regexes.
I'm still thinking about how to simplify the problem at best.

Ideas welcome :-)

preliminary fix applied in 1.0.6 (just released)

Great news, thanks!