Config.js with json properties
See original GitHub issueHello,
I’m following this example: https://github.com/amzn/style-dictionary/blob/main/examples/advanced/node-modules-as-config-and-properties/config.js
And I want to convert all my colors to XCode colorsets, hence for this I need to convert each color to separate file, which is there in example:
files: Object.keys(properties.color).map((colorType) => ({
destination: `${colorType}.js`,
format: 'javascript/es6',
// Filters can be functions that return a boolean
filter: (prop) => prop.attributes.type === colorType
}))
But there is issue with properties
variable:
const properties = require('./properties');
This code does import all properties in .js format, but I can’t change properties and having simple json files as here https://github.com/amzn/style-dictionary/tree/main/examples/basic/properties. How to get this const properties
from json files.
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
Advanced JSON configuration properties
You can use a JSON configuration file to define certain properties for individual tenants, rather than configuring environment variables ...
Read more >jsconfig.json Reference - Visual Studio Code
The jsconfig. json file specifies the root files and the options for the features provided by the JavaScript language service.
Read more >Configuring properties from config.json using services. ...
You can access specific value in config.json like: Configuration.Get("SomeOptions:MyOption ...
Read more >Configuration with app.json / app.config.js
Properties. The Expo config configures many things such as app name, icon, splash screen, deep linking scheme ...
Read more >JSON-based Config
Chart, or any of its descendant elements, are basically a JavaScript object. Objects can have methods and properties. Methods (or functions) cannot be ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I made a quick example project to answer this question: https://github.com/dbanksdesign/style-dictionary-example-colorsets
The example answers 2 questions:
dictionary.allProperties
in a custom action.Posting the code here (note this might not match the example if I update the example in the future):
Hopefully that answers your questions, if not let me know!
Awesome @dbanksdesign, works a charm - thanks so much 😃