Skip to content

Commit

Permalink
add sort
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasoppermann committed Dec 13, 2024
1 parent e9301be commit 236c2fd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/formats/cssAdvanced.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type {TransformedToken, FormatFn, FormatFnArguments, FormattingOptions} from 'style-dictionary/types'
import {format} from 'prettier'
import {fileHeader, formattedVariables} from 'style-dictionary/utils'
import {fileHeader, formattedVariables, sortByName} from 'style-dictionary/utils'

const wrapWithSelector = (css: string, selector: string | false): string => {
// return without selector
Expand Down Expand Up @@ -69,7 +69,7 @@ export const cssAdvanced: FormatFn = async ({
// filter tokens to only include the ones that pass the matcher
const filteredDictionary = {
...dictionary,
allTokens: dictionary.allTokens.filter(matcher || (() => true)),
allTokens: dictionary.allTokens.filter(matcher || (() => true)).sort(sortByName),
}
// early abort if no matches
if (!filteredDictionary.allTokens.length) continue
Expand Down

0 comments on commit 236c2fd

Please sign in to comment.