Skip to content

"Calc" with capital C with variable inside - breaks: "Undefined operation" #3143

@yairEO

Description

@yairEO

Couldn't find a similar issue in the issues page or Google:

The below appear to break node-sass, only if a variable (custom property) exists inside the Calc (capital C).

a{ top: Calc(var(--foo) * 2) }
> node-sass --output-style compressed -o ./ foo.scss

{
  "status": 1,
  "file": "C:/projects/test/foo.scss",
  "line": 1,
  "column": 14,
  "message": "Undefined operation: \"var(--foo) times 2\".",
  "formatted": "Error: Undefined operation: \"var(--foo) times 2\".\n        on line 1 of ui-range.scss\n>> a{ top: Calc(var(--foo) * 2) }\n   -------------^\n"
}

I would expect node-sass to ignore casing of Calc or any known CSS keyword that is capitalized in order to make sure the SASS compiler would not treat it as SCSS in case the same keyword also exists in SCSS-world.

I've tested on sassmeister.com and it works as expected.

  • NPM version: 7.0.15
  • Node version: v15.4.0
  • Node Process:
{
  node: '15.4.0',
  v8: '8.6.395.17-node.22',
  uv: '1.40.0',
  zlib: '1.2.11',
  brotli: '1.0.9',
  ares: '1.16.1',
  modules: '88',
  nghttp2: '1.41.0',
  napi: '7',
  llhttp: '2.1.3',
  openssl: '1.1.1g',
  cldr: '38.0',
  icu: '68.1',
  tz: '2020b',
  unicode: '13.0'
}
  • Node Platform: win32
  • Node architecture: x64
  • node-sass version:
node-sass       5.0.0   (Wrapper)       [JavaScript]
libsass         3.5.5   (Sass Compiler) [C/C++]

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions