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

Format scss/map-deep fails if value is string or null #837

Closed
supermueller opened this issue Jun 23, 2022 · 0 comments
Closed

Format scss/map-deep fails if value is string or null #837

supermueller opened this issue Jun 23, 2022 · 0 comments

Comments

@supermueller
Copy link
Contributor

If the token file contains values that are null or strings then (under some circumstances) the parsing fails (error message: TypeError: Cannot read property 'hasOwnProperty' of null).

spike.js

const StyleDictionary = require('style-dictionary')

const StyleDictionaryExtended = StyleDictionary.extend({
    "source": ["./spike.tokens.json"],
    "platforms": {
      "scss": {
        "transformGroup": "scss",
        "files": [{
          "destination": "spike.variables.scss",
          "format": "scss/map-deep"
        }]
      }
    }
  }
)

StyleDictionaryExtended.buildAllPlatforms()

spike.tokens.js

{
  "color": {
    "primary": {
      "brand orange": {
        "type": "color",
        "value": "orange"
      },
      "brand blue": {
        "type": "color",
        "value": "blue"
      },
      "description": null
    }
  }
}

I do have a solution for this and will create a pull request for it.

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

1 participant