plentycode/sass-export

Broken exporting of font-family values (values with commas)

kasperekt opened this issue · 3 comments

sass-export doesn't work with exporting variables that includes commas, like font-family: Arial, Helvetica, sans-serif;. It results with an error:

Error: Only 1 argument allowed, but 3 were passed.
  ┌──> stdin
2 │ #sass-export-id.some-font-family{content:"#{inspect(Arial, Helvetica, sans-serif)}";}
  │                                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invocation
  ╵
  ┌──> sass:meta
1 │ @function inspect($value) {
  │           ━━━━━━━━━━━━━━━ declaration
  ╵
...
formatted: 'Error: Only 1 argument allowed, but 3 were passed.\n' +
    '  ┌──> stdin\n' +
    '2 │ #sass-export-id.some-font-family{content:"#{inspect(Arial, Helvetica, sans-serif)}";}\n' +
    '  │                                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invocation\n' +
    '  ╵\n' +
    '  ┌──> sass:meta\n' +
    '1 │ @function inspect($value) {\n' +
    '  │           ━━━━━━━━━━━━━━━ declaration\n' +
    '  ╵\n' +
    '  stdin 2:45  root stylesheet',
  line: 2,
  column: 45,
  file: 'stdin',
  status: 1

Basically it looks like Sass's inspect function doesn't accept values with commas, at least without wrapping them in quotes. This might actually be a resolution for this issue.

tnir commented

Affects me when upgraded from 1.0.8 to 2.0.0.

Can we address this problem with reverting cabfc8c and 99ae63d?

Full diff between 1.0.8 and 2.0.0: 1.0.8...2.0.0

Hi guys, sorry for the inconvenience. I've just opened a new PR that fixes this issue #69.
The inspect function is used to convert the map values in dart-sass but caused this issue. In the new PR the inspect function is only used when we need it since we are working with a map value.

Getting error when used in map:

$typography: (
  body: "GothamNarrowSSm, Helvetica, Arial, sans-serif;",
  display: "GothamNarrowSSm, Helvetica, Arial, sans-serif;",
  code: monospace,
);
Error: expected ")".
    ╷
192 │ #sass-export-id._body{content:"#{inspect("GothamNarrowSSm)}";}
    │                                                             ^
    ╵
  stdin 192:61  root stylesheet
    at Object.wrapException (/Users/Omar_Assadi/dev/wave/ui-lib/node_modules/sass/sass.dart.js:1252:43)
    at SpanScanner.error$3$length$position (/Users/Omar_Assadi/dev/wave/ui-lib/node_modules/sass/sass.dart.js:78764:15)
    at SpanScanner._fail$1 (/Users/Omar_Assadi/dev/wave/ui-lib/node_modules/sass/sass.dart.js:78889:12)
    at SpanScanner.expectChar$2$name (/Users/Omar_Assadi/dev/wave/ui-lib/node_modules/sass/sass.dart.js:78845:12)
    at SpanScanner.expectChar$1 (/Users/Omar_Assadi/dev/wave/ui-lib/node_modules/sass/sass.dart.js:78848:19)
    at ScssParser0._stylesheet0$_argumentInvocation$2$allowEmptySecondArg$mixin (/Users/Omar_Assadi/dev/wave/ui-lib/node_modules/sass/sass.dart.js:111841:10)
    at ScssParser0._stylesheet0$_argumentInvocation$1$allowEmptySecondArg (/Users/Omar_Assadi/dev/wave/ui-lib/node_modules/sass/sass.dart.js:111849:19)
    at ScssParser0.identifierLike$0 (/Users/Omar_Assadi/dev/wave/ui-lib/node_modules/sass/sass.dart.js:112636:61)
    at ScssParser0._stylesheet0$_singleExpression$0 (/Users/Omar_Assadi/dev/wave/ui-lib/node_modules/sass/sass.dart.js:112200:22)
    at ScssParser0._stylesheet0$_expression$3$bracketList$singleEquals$until (/Users/Omar_Assadi/dev/wave/ui-lib/node_modules/sass/sass.dart.js:111878:40) {
  formatted: 'Error: expected ")".\n' +
    '    ╷\n' +
    '192 │ #sass-export-id._body{content:"#{inspect("GothamNarrowSSm)}";}\n' +
    '    │                                                             ^\n' +
    '    ╵\n' +
    '  stdin 192:61  root stylesheet',
  line: 192,
  column: 61,
  file: 'stdin',
  status: 1
}