Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

calc() is being evaluated and the result is being outputted to CSS instead of the calc() function being outputted to CSS #2144

Closed
tleifj opened this issue Nov 7, 2017 · 5 comments

Comments

@tleifj
Copy link

tleifj commented Nov 7, 2017

  • NPM version (npm -v): 3.10.10
  • Node version (node -v): 6.12.0
  • Node Process (node -p process.versions): { http_parser: '2.7.0',
    node: '6.12.0',
    v8: '5.1.281.108',
    uv: '1.15.0',
    zlib: '1.2.11',
    ares: '1.10.1-DEV',
    icu: '58.2',
    modules: '48',
    openssl: '1.0.2m' }
  • Node Platform (node -p process.platform): orm
    darwin
  • Node architecture (node -p process.arch): x64
  • node-sass version (node -p "require('node-sass').info"): node-sass 3.13.1 (Wrapper) [JavaScript]
    libsass 3.3.6 (Sass Compiler) [C/C++]
  • npm node-sass versions (npm ls node-sass): 3.13.1

We have a Sass function and mixin that responsively changes the font size based on viewport width. It does this by calculating a constant rate of change and then outputting a calc() value that is essentially calc(Xvw + Yrem). The key is that the css is a calc() with the vw in it so that it can constantly be evaluating the font size based on the viewport width and changing accordingly. Our function worked great when we were using node v4.2.2 (npm v3.8.6) but not on node version 6 or 7. Instead, the calc() will be evaluated and then a static value will be outputted to the stylesheet (say font-size: 4.25rem; instead of the desired font-size: calc(1.4vw + 2.64rem); or whatever).

I would expect the calc() to be outputted to the stylesheet instead of being evaluated and then the result being outputted.

@nschonni
Copy link
Contributor

nschonni commented Nov 8, 2017

Can you reproduce this with the latest, you're on an old version

@xzyfer
Copy link
Contributor

xzyfer commented Nov 12, 2017

This should be resolved with #2071

@tleifj
Copy link
Author

tleifj commented Nov 13, 2017

Hello,

I tried updating with the latest version and it still wasn't working. This module was being used by another called gulp-sass and when I updated this package it seemed to fix it. node-sass is now outputting calc() correctly now with node 6 and 7.

Thank you.

@jcampbell05
Copy link

@tleifj how did you fix this ? I am still having it

@xzyfer
Copy link
Contributor

xzyfer commented Apr 19, 2018 via email

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

5 participants