style-dictionary
style-dictionary copied to clipboard
Docs "Format Configuration" has a mistake
Hey, I believe I spotted an error in the docs here https://amzn.github.io/style-dictionary/#/formats?id=format-configuration
{
"files": [{
"destination": "map.scss",
"format": "scss/map-deep",
"mapName": "my-tokens"
}]
}
should be
{
"files": [{
"destination": "map.scss",
"format": "scss/map-deep",
"options": {
"mapName": "my-tokens"
}
}]
}
At least, this is what works for me for css/variables selector option: Playground link
Happy to send a PR with fix
Hey @jorenbroekema thanks for bringing this up! I believe it is actually correct as is. Looking at the source code for the scss/map-deep
format, it is accessing mapName
from the file object directly and not the options
object on the file: https://github.com/amzn/style-dictionary/blob/main/lib/common/templates/scss/map-deep.template#L20
We have been working towards moving configuration onto the options
object with more recent additions though so this might be something we want to update in the future.
Also, the playground link you sent doesn't appear to show the issue. Here is what I am seeing:
![CleanShot 2022-03-08 at 14 11 30@2x](https://user-images.githubusercontent.com/321279/157334438-071bac03-1a0d-4a80-960d-b6a0f70a8085.png)
Yeah in the playground it's correct, and it's inside an options object. I guess it was moved into the options object for some default formats but not others?
{
"files": [{
"destination": "map.scss",
"format": "scss/map-deep",
"mapName": "my-tokens"
}]
}
versus
{
"files": [{
"destination": "_variables.css",
"format": "css/variables",
"options": {
"selector": ":host"
}
}]
}