-
Notifications
You must be signed in to change notification settings - Fork 567
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
Add Custom Parser Support #85
Comments
Easy half-step: allow a property file to be a node module that exports a js obj... |
I might give this a shot. My initial take is that a
If we go forward with this I would extract the current JS/JSON parser into a parser function (basically just |
Just dug into the code a bit more. One important change that my proposed |
We should decide if we want to do this, or if we want to do something more direct like #19. Either way, probably target for a 3.0 release? |
@chazzmoney I don't think #19 is necessarily mutually exclusive with this, we could add the ability for custom parsers and then include those parsers out of the box. Thoughts? Agreed about moving to 3.0. If there's still enough value in this I might have some time in a couple weeks to bang it out. Do you have any thoughts on delaying the file parsing that I mentioned in my last comment? |
I agree about delaying parsing until we call exportPlatform (which is called internally from buildPlatform), but yea we should do that in the next major release to not break anything. |
Agreed on the delaying of parsing. 👍🏽 |
Thought I'd share my custom build script to support YAML until it's officially supported: https://gist.github.com/chrisvxd/81137cb29b20a38c438c7918c776af4c |
This will be in the next major release: 3.0. The code is already merged into the 3.0 branch (#429)! 🚀 |
This is already in the RC of 3.0 which you can get today with |
Acceptance Criteria
User should be able to supply a custom parser to the style dictionary to be used when reading property files. It should be done in a generic way so that any parser (yaml, hjson, and any other) could conceivably be used. A parser should be a function that takes a file (as a path string) as input, and outputs a JS object. Any function that follows this could be used as a parser.
How does this benefit the user?
Some do not like writing JSON, it can be verbose and not as simple as something like yaml. This will allow users to use any data formatting syntax to describe their style dictionaries. This fits in with the spirit of style dictionary in being flexible to accommodate any project/platform/framework. At its core, a style dictionary is a data structure for defining styles; the filetype the data structure is written in is irrelevant.
The text was updated successfully, but these errors were encountered: