question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Flat output turns "2x" into "2-x"

See original GitHub issue

I have tokens like:

{
  space: {
    "2x-small": { value: "2px" },
    "x-small": { value: "4px" },
    "small": { value: "8px" },
    "medium": { value: "16px" },
    "large": { value: "32px" },
    "x-large": { value: "64px" }
  }
}

And when they get turned into Sass variables, the ones with “2x” come out as e.g.:

$space-2-x-small

Likewise in the flat Sass map format, but in the deep Sass map format, the map keys come out as 2x even though the variable referenced is 2-x:

'padding': (
      '2x-small': (
        'base': $mri-space-padding-2-x-small-base
      ),

🤔 Very strange, but is this intended? (Perhaps to ensure that the keys don’t break some other output?) I’m using JSON5 format, by the way, if that’s important.

style-dictionary: 2.8.0

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:4
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

6reactions
littlefengerscommented, Feb 11, 2020

I had to make a custom transform with this package: https://github.com/blakeembrey/change-case/tree/master/packages/param-case

StyleDictionary.registerTransform({
  name: 'name/cti/kebabCustom',
  type: 'name',
  transformer: function(prop,options){
    return paramCase([options.prefix].concat(prop.path).join(' '));
  }
})```

5reactions
chazzmoneycommented, Feb 23, 2021

@nategreen @wiese @littlefengers @samwilliscreative

We are changing our case-changing support in 3.0 to use change-case and want to create some unit tests around it. If you have any challenging ones, please submit them on #500

Read more comments on GitHub >

github_iconTop Results From Across the Web

The exponential function - Math Insight
A simple example is the function f(x)=2x. Exponential function $2^x$. As illustrated in the above graph of f, the exponential function increases rapidly....
Read more >
Mathematics 1 Problem Sets - Phillips Exeter Academy
Reading each question care- fully is essential, especially since definitions, highlighted in italics, are routinely inserted into the problem ...
Read more >
Algebra I Regents Exam Questions at Random Worksheet # 1
b) Using one of the methods stated in part a, solve f(x) = 0 for x, to the nearest tenth. 13 A system...
Read more >
polynomials - Australian Mathematical Sciences Institute
x2 + 1 is a non-monic polynomials of degree 4 with leading coefficient and constant term 1. In the first polynomial, the coefficients...
Read more >
Teaching Linear Equations in Math | Houghton Mifflin Harcourt
Consider 2x + y – 6 = 0. This equation is not in slope-intercept form, but you can use equality properties to get...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found