vaadin / sass-compiler

A Java Sass compiler implementation
53 stars 25 forks source link

Brackets are removed within CSS calc statements #313

Open CedricReichenbach opened 7 years ago

CedricReichenbach commented 7 years ago

Brackets within calc() statements in CSS should not be touched by the compiler, but are currently removed.

Example source code:

.foo {
  width: calc(2 * (3px + 4px));
}

Expected output:

.foo {
  width: calc(2 * (3px + 4px)); /* -> 14px */
}

Actual output:

.foo {
  width: calc(2 * 3px + 4px); /* -> 10px */
}

This is especially painful because it leads to subtle, hard to detect errors in layouts.

saivan commented 6 years ago

I'm having the same problem, this behaviour isn't sensible.

daPhantom commented 6 years ago

Can confirm this.

This

.logo {
    margin-left: calc(((100vw - 104px) / 2) - 40px);
}

results in this broken CSS snippet within the compiled CSS

.logo {
    margin-left: calc(100vw - 104px/ 2- 40px);
}

Please fix this behavior since it is really misleading when working with SASS.