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

font-size: max(vw, px) causes internal error #2815

Closed
primiano opened this issue Jan 11, 2020 · 5 comments
Closed

font-size: max(vw, px) causes internal error #2815

primiano opened this issue Jan 11, 2020 · 5 comments

Comments

@primiano
Copy link

  • NPM version (npm -v): 6.4.1
  • Node version (node -v): v10.10.0
  • Node Process (node -p process.versions):
  • Node Platform (node -p process.platform): darwin
  • Node architecture (node -p process.arch): x64
  • node-sass version (node -p "require('node-sass').info"):
node-sass	4.13.0	(Wrapper)	[JavaScript]
libsass  	3.5.4	(Sass Compiler)	[C/C++]

Repro CSS:

h1 { font-size: max(1vw, 20px); }

Error:

[0] {
[0]   "status": 3,
[0]   "message": "Incompatible units: 'vw' and 'px'.",
[0]   "formatted": "Internal Error: Incompatible units: 'vw' and 'px'.\n"
[0] }

It seems legit CSS according to https://developer.mozilla.org/en-US/docs/Web/CSS/max

@nschonni
Copy link
Contributor

This is only supported in dart-sass https://sass-lang.com/documentation/syntax/special-functions#min-and-max
You need to use string interpolation (similar to CSS variables) for this to work outside of dart-sass

h1 { font-size: #{"max(1vw, 20px)"}}; 

@primiano
Copy link
Author

Ahh I see.
For posterity, it seems that also calc(max(1vw, 20px)) works.
Closing as a workaround is available (maybe the error message could give some better clues though)

@tolumide-ng
Copy link

Ahh I see.
For posterity, it seems that also calc(max(1vw, 20px)) works.
Closing as a workaround is available (maybe the error message could give some better clues though)

thank you

@ReganRyanNZ
Copy link

Best solution: sass is case sensitive, css is not, so MIN(10px, 5vh) will run as css no problem :)

Other solutions, which didn't work for me because of controller/system tests crashing:

  • unquote("min(10px, 5vh)")
  • calc(min(10px, 5vh))

For all of the above, any variables need to be wrapped in #{$my-var} brackets

tossy310 added a commit to nishi-owls/nishi-owls that referenced this issue Feb 19, 2022
* Build Jekyll with actions

* update Gemfile etc

* Fix sass build error

Ref: sass/node-sass#2815
@beyzanur-seyhan
Copy link

beyzanur-seyhan commented Aug 23, 2022

unquote("min(10px, 5vh)")

Best solution: sass is case sensitive, css is not, so MIN(10px, 5vh) will run as css no problem :)

Other solutions, which didn't work for me because of controller/system tests crashing:

  • unquote("min(10px, 5vh)")
  • calc(min(10px, 5vh))

For all of the above, any variables need to be wrapped in #{$my-var} brackets

unquote("min(10px, 5vh)") --> solution for me

Thank you!

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

6 participants