Skip to content
This repository was archived by the owner on Dec 19, 2024. It is now read-only.

returns NaN when dividing var() in calc() in preserve mode #427

Closed
rokoroku opened this issue Nov 26, 2017 · 4 comments
Closed

returns NaN when dividing var() in calc() in preserve mode #427

rokoroku opened this issue Nov 26, 2017 · 4 comments
Assignees

Comments

@rokoroku
Copy link

with postcss-cssnext options

features: {
  customProperties: {
    preserve: true
  }
}

below css

:root {
    --iconSize: 14px;
    --lineHeight: calc(var(--iconSize) / 8);
}

results

:root {
    --iconSize: 14px;
    --lineHeight: NaN;
}

It's weird, because orginal css calc() should work with var() too.
However, multiplying var() is working well.

So my current workaround is

:root {
    --iconSize: 14px;
    --lineHeight: calc(var(--iconSize) * .125);
}
@Semigradsky
Copy link
Collaborator

My result:

:root {
    --iconSize: 14px;
    --lineHeight: 1.75px;
    --lineHeight: NaN;
}

I will investigate.

@Semigradsky
Copy link
Collaborator

postcss/postcss-calc#44

@MoOx
Copy link
Owner

MoOx commented Nov 26, 2017

:root {
    --iconSize: 14px;
    --lineHeight: calc(var(--iconSize) * .125);
}

body {
line-height: var(--lineHeight)
}

gives

body {
line-height: 1.75px
}

in the playground, so it might be a recent bug.

@Semigradsky
Copy link
Collaborator

Semigradsky commented Nov 26, 2017

Fixed in MoOx/reduce-css-calc@483e355
Just reinstall reduce-css-calc dependency

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants