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

Update docs to include filters #286

Closed
dbanksdesign opened this issue May 30, 2019 · 6 comments
Closed

Update docs to include filters #286

dbanksdesign opened this issue May 30, 2019 · 6 comments

Comments

@dbanksdesign
Copy link
Member

The .registerFilter function is documented in the API, but we don't really explain the concept of filtering in the docs very well.

@gearsandcode
Copy link

I've been trying to get this to work for an hour or so now. I'm not sure how to use it based on the docs.

Is it:

"platforms": {
    "web/scss": {
            "transformGroup": "tokens-scss",
            "buildPath": `dist/${brand}/web/`,
            **"filter": "filter-here",**
            "prefix": "",
            "files": [
                {
                    "destination": `scss/${category}-tokens.scss`,
                    "format": "scss/variables",
                    **"filter": "or-filter-here"**
                }
            ]
        }
}...

StyleDictionaryPackage.registerFilter({
    name: 'filter-alias',
    matcher: function(prop) {
        return prop.attributes.type !== 'alias';
    }
})

@dbanksdesign
Copy link
Member Author

It is the second one. Also super cool use of interpolated strings in your config!

@gearsandcode
Copy link

gearsandcode commented Jun 25, 2019

I couldn’t get this to work. I had to use the original syntax before registerFilter was introduced. That syntax doesn’t allow for a negative match, so I ended up having to add a value for inclusion vs. exclusion. That’s not really ideal.

I also couldn’t get “scss/icons” to work. I’m not sure what my token file needs to look like. I tried “F101”, “/F101”, “//F101” and the html escaped version like I found in a token file in one of the examples, but it didn’t work. If you’d like I can open new tickets for both of these with more info and once I get them resolved I can tackle this ticket with a PR. I just need some help getting things working first. Thanks for the quick response!

@dbanksdesign
Copy link
Member Author

Yea that would be great if you could open 2 issues. In the filter one can you post your full code for that file, and any errors you are getting? Thanks!

@chazzmoney
Copy link
Collaborator

@gearsandcode Just checking in - if you could open tickets for these that would be super useful for us to start investigation and commentary on them. No PRs required! :-D

I can open them as well, but would prefer if you did it as you will represent your issues better.

@dbanksdesign
Copy link
Member Author

Closing this as we have 2 new issues tracking this.

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

3 participants