scss-parser icon indicating copy to clipboard operation
scss-parser copied to clipboard

calling mixin with the the module scoped variable fails

Open theKashey opened this issue 3 years ago • 1 comments

🚫 not working

@use "~@quiz-ui/styles/mixin";
@use "~@quiz-ui/styles/media";

.button {
  @include mixin.until(media.$sm) {
    width: 100%;
  }
}

Error: Selector ("class") expected "identifier" or "interpolation" (1:23) where . is from .$sm

✅ working

@use "~@quiz-ui/styles/mixin";
@use "~@quiz-ui/styles/media" as *;

.button {
  @include mixin.until($sm) {
    width: 100%;
  }
}

theKashey avatar Apr 30 '21 07:04 theKashey

Hi, I'm facing the same issue. It's related with syntax mentioned by @theKashey media.$sm.

@use '~@organisation/colors' as colors;
 
 .example {
   color: color.$some_color; // here's the problem
 }

And the exception stack is:

Error: Selector ("class") expected "identifier" or "interpolation" (3:31)
    at InputStream.err (C:\Dev\profiler-example\node_modules\?[4mscss-parser?[24m\lib\input-stream.js:104:11)
    at Object.err (C:\Dev\profiler-example\node_modules\?[4mscss-parser?[24m\lib\input-stream.js:138:16)
    at TokenStream.err (C:\Dev\profiler-example\node_modules\?[4mscss-parser?[24m\lib\token-stream.js:251:23)
    at Object.err (C:\Dev\profiler-example\node_modules\?[4mscss-parser?[24m\lib\token-stream.js:554:16)
    at Parser.parse_selector (C:\Dev\profiler-example\node_modules\?[4mscss-parser?[24m\lib\parse.js:624:19)
    at C:\Dev\profiler-example\node_modules\?[4mscss-parser?[24m\lib\parse.js:374:21
    at Parser.maybe_function (C:\Dev\profiler-example\node_modules\?[4mscss-parser?[24m\lib\parse.js:518:12)
    at Parser.parse_atom (C:\Dev\profiler-example\node_modules\?[4mscss-parser?[24m\lib\parse.js:359:17)
    at Parser.parse_node (C:\Dev\profiler-example\node_modules\?[4mscss-parser?[24m\lib\parse.js:298:23)
    at InputStream.err (C:\Dev\profiler-example\node_modules\?[4mscss-parser?[24m\lib\input-stream.js:104:11)
    at Object.err (C:\Dev\profiler-example\node_modules\?[4mscss-parser?[24m\lib\input-stream.js:138:16)
    at TokenStream.err (C:\Dev\profiler-example\node_modules\?[4mscss-parser?[24m\lib\token-stream.js:251:23)
    at Object.err (C:\Dev\profiler-example\node_modules\?[4mscss-parser?[24m\lib\token-stream.js:554:16)
    at Parser.parse_selector (C:\Dev\profiler-example\node_modules\?[4mscss-parser?[24m\lib\parse.js:624:19)
    at C:\Dev\profiler-example\node_modules\?[4mscss-parser?[24m\lib\parse.js:374:21
    at Parser.maybe_function (C:\Dev\profiler-example\node_modules\?[4mscss-parser?[24m\lib\parse.js:518:12)
    at Parser.parse_atom (C:\Dev\profiler-example\node_modules\?[4mscss-parser?[24m\lib\parse.js:359:17)
    at Parser.parse_node (C:\Dev\profiler-example\node_modules\?[4mscss-parser?[24m\lib\parse.js:298:23)
    at Parser.parse_block (C:\Dev\profiler-example\node_modules\?[4mscss-parser?[24m\lib\parse.js:464:25)

PrzemyslawMikos avatar Nov 29 '21 11:11 PrzemyslawMikos