Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

type-of(1 * 1#{$unit}) should be a number #3111

Open
Anthony-Gaudino opened this issue Jun 21, 2020 · 4 comments
Open

type-of(1 * 1#{$unit}) should be a number #3111

Anthony-Gaudino opened this issue Jun 21, 2020 · 4 comments

Comments

@Anthony-Gaudino
Copy link

Anthony-Gaudino commented Jun 21, 2020

In my code, using the latest version of node-sass I'm trying to add a unit to a number like bellow, which is resulting in a string type. I expected it to be a number type.

Minimal example on libsass.ocbnet.ch

input.scss

$unit: "px";
@debug type-of(1 * 1#{$unit});  // string

Actual results

string

Expected result

number

On this website http://beautifytools.com/scss-compiler.php I get the expected number result using the following code:

$unit: "em";
$res: 1 * 1#{$unit};

a {
  resttype: type-of($res);
  res: $res;
}
a {
	resttype: number;
	res: 1em;
}

version info:

node-sass	4.14.1	(Wrapper)	[JavaScript]
libsass  	3.5.5	(Sass Compiler)	[C/C++]
@stof
Copy link

stof commented May 5, 2021

Running that in dart-sass does not give a number. It gives a list (with a number as first element and a string as second element)

@mgreter
Copy link
Contributor

mgreter commented May 5, 2021

As noted, LibSass 4.0 WIP branch will also results list here now (which is correct).
Can't close yet, since that is not yet merged and current master produces string.

@stof
Copy link

stof commented May 5, 2021

yeah, but in any case, the "expected result" described in this issue is wrong. I have no idea what compiler is used by https://beautifytools.com/scss-compiler.php, but it is a broken one.

@stof
Copy link

stof commented May 5, 2021

@Anthony-Gaudino for reference, https://www.sassmeister.com/ is a much better online tool to test a sass compiler online, as it uses the official implementation (even though not the latest one currently)

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

No branches or pull requests

3 participants