Skip to content

Commit

Permalink
feat: add style-utils file to base project (#1195)
Browse files Browse the repository at this point in the history
* feat: add style-utils file to base project

* fix: address spec comments

* fix: indentation

---------

Co-authored-by: Galina Edinakova <[email protected]>
  • Loading branch information
onlyexeption and gedinakova authored Jan 25, 2024
1 parent 5f6cd63 commit 112f27d
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* Creates a class transformer function that maps matches from a module object
* @param styles Object map of classes and their scoped name, normally from a CSS Module import
*/
export default function createClassTransformer(styles: any) {
return (classes: string) => {
return classes
.split(' ')
.map(className => styles[className] || className)
.join(' ');
}
}

0 comments on commit 112f27d

Please sign in to comment.