Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature request possibly: outputReferences to the scss/map-deep #712

Closed
JackHowa opened this issue Oct 6, 2021 · 2 comments
Closed

feature request possibly: outputReferences to the scss/map-deep #712

JackHowa opened this issue Oct 6, 2021 · 2 comments

Comments

@JackHowa
Copy link

JackHowa commented Oct 6, 2021

feature request possibly:

https://amzn.github.io/style-dictionary/#/formats?id=scssmap-deep

before:

/**
 * Do not edit directly
 * Generated on Tue, 05 Oct 2021 21:06:03 GMT
 */

$list-components-date-font-weight: 900 !default;
$links-bar-font-size: 14px !default;

$blocks: (
  'list': (
    'components': (
      'date': (
        'font-weight': $list-components-date-font-weight
      )
    )
  ),
  'links-bar': (
    'font-size': $links-bar-font-size
  )
);

ideally after:

/**
 * Do not edit directly
 * Generated on Tue, 05 Oct 2021 21:06:03 GMT
 */

$blocks: (
  'list': (
    'components': (
      'date': (
        'font-weight': 900 
      )
    )
  ),
  'links-bar': (
    'font-size': 14px
  )
);

minimal example: https://github.com/JackHowa/auto-rebuild-watcher-scss-css/tree/POC-update-font-color-watch-theme

Originally posted by @JackHowa in #643 (comment)

notlee added a commit to notlee/style-dictionary that referenced this issue Oct 19, 2021
Use the `formattedVariables` within the `scss/map-deep` formatter
to add support for the `outputReferences` option.
Closes: amzn#712

A side effect of this change is that `scss/map-deep` also
supports the `themeable` token property. For backward compatibility
changes have been made so tokens default to being themeable
with `scss/map-deep`, unlike for `scss/variables` where tokens
are not themeable by default. See amzn#474
@notlee
Copy link
Contributor

notlee commented Oct 19, 2021

Hi, I came across the same thing and had a go at adding support here: #720

@notlee
Copy link
Contributor

notlee commented Oct 20, 2021

Oh, sorry, I didn't read your issue properly. My interpretation of how an outputReferences option for scss/map-deep would work is different. I'd expect it still to output global variables but those global variables would reference each other. That's what I've attempted to achieve in #720

before:

$color-core-neutral-0: #ffffff !default;
$color-background-primary: #ffffff !default;

$design-system-tokens: (
  'color': (
    'background': (
      'primary': $color-background-primary
    ),
    'neutral': (
      '0': $color-core-neutral-0,
    )
  )
)

after:

$color-core-neutral-0: #ffffff !default;
$color-background-primary: $color-core-neutral-0 !default;

$design-system-tokens: (
  'color': (
    'background': (
      'primary': $color-background-primary
    ),
    'neutral': (
      '0': $color-core-neutral-0,
    )
  )
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants