-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
style(token-studio): refactor component generator
- Loading branch information
1 parent
cf220b7
commit f24849f
Showing
3 changed files
with
16 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,9 @@ | ||
import fs from 'fs-extra'; | ||
|
||
const basePath = `src/global/styles/tokens`; | ||
|
||
// filters tokens by themable and from which tokenset they originate | ||
// must match per component name, in this repository we currently only have "button" | ||
export const componentFilter = | ||
(cat, themeable = false) => | ||
(token) => { | ||
const tokenThemable = Boolean(token.attributes.themeable); | ||
|
||
return ( | ||
themeable === tokenThemable && token.filePath.endsWith(`${cat}.json`) | ||
); | ||
}; | ||
(cat) => | ||
(token) => token.filePath.startsWith(`${basePath}/components/${cat}.json`); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters