Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove "Semantic" folder in Figma output
We no longer export primitive tokens, so no point in creating this grouping
  • Loading branch information
aduth committed Nov 21, 2025
commit 93f30ba8fd4a9d193e6c86e603d87a712b26c2d6
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ function transformTokenName( { id }: { id: string } ) {
// Capitalize first segment
.replace( /^(\w+)\./g, ( _, g1 ) => `${ titleCase( g1 ) }/` )
// Capitalize
.replace( /semantic\./g, 'Semantic/' )
.replace( /semantic\./g, '' )
// Color-specific transformation for semantic tokens:
// - add extra folder (Background, Foreground, Stroke)
// - swap "tone" folder order, capitalize
// - limit bg-* to 6 characters
// - keep last part of the token name with dots (eg no folders)
.replace(
/(color\/Semantic)\/([\w,\-]+)\.(\w+)\.(.*)/gi,
/(Color)\/([\w,\-]+)\.(\w+)\.(.*)/g,
( _, prefix, element, tone, emphasisAndState ) => {
let extraFolder = '';
let elementName = element;
Expand All @@ -64,7 +64,7 @@ function transformTokenName( { id }: { id: string } ) {
// - limit name to 3 characters after prefix
// - keep last part of the token name with dots (eg no folders)
.replace(
/(Dimension\/Semantic)\/(\w+)\.(\w+)\.(.*)/g,
/(Dimension)\/(\w+)\.(\w+)\.(.*)/g,
( _, prefix, property, target, modifier ) => {
let extraFolder = '';
let propertyName = property;
Expand Down
Loading