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

CSS custom properties in HSL color definitions wont compile #2237

@necccc

Description

@necccc

Using CSS custom properties with HSL color definitions in scss files cause an error when trying to compile it using node-sass.

Example code:

.foo {
    --hue: 70;

    background-image: linear-gradient(
        hsl(var(--hue), 100%, 50%),
        hsl(0, 100%, 50%)
    );
}

This is valid CSS by the way, it should compile anyway.

The error

Error: argument `$hue` of `hsl($hue, $saturation, $lightness)` must be a number

Backtrace:

node-sass-hsl-var.scss:7, in function `hsl`
node-sass-hsl-var.scss:7
on line 7 of node-sass-hsl-var.scss
>>         hsl(var(--hue), 100%, 50%),
--------
}
  • Validate that it runs with both Ruby Sass and LibSass

Note: this won't validate because the validator seems broken too.

As this seemed a compilation error, went to libsass, but their sourcemap inspector compiles the example correctly

When reporting an bug, you must provide this information:

  • NPM version (npm -v):
    5.3.0
  • Node version (node -v):
    8.6.0
  • Node Process (node -p process.versions):
    { http_parser: '2.7.0',
    node: '8.6.0',
    v8: '6.0.287.53',
    uv: '1.14.1',
    zlib: '1.2.11',
    ares: '1.10.1-DEV',
    modules: '57',
    nghttp2: '1.25.0',
    openssl: '1.0.2l',
    icu: '59.1',
    unicode: '9.0',
    cldr: '31.0.1',
    tz: '2017b' }
  • 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.7.2 (Wrapper) [JavaScript]
    libsass 3.5.0.beta.2 (Sass Compiler) [C/C++]
  • npm node-sass versions (npm ls node-sass):
    [email protected]

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