Skip to content

Commit

Permalink
fix: replace placeholders with global flag
Browse files Browse the repository at this point in the history
  • Loading branch information
yarastqt committed Aug 17, 2020
1 parent c48786f commit 71c3759
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/core/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ StyleDictionaryApi.registerFormat({
const options = Object.assign(defaultOptions, (this as any).options)
const { entry, platform } = store.get('meta')
const selector = options.selector
.replace(/\[entry\]/, entry)
.replace(/\[platform\]/, platform)
.replace(/common\/?/, '')
.replace(/\[entry\]/g, entry)
.replace(/\[platform\]/g, platform)
.replace(/common\/?/g, '')

const transformers = config.transforms.filter((transform) => transform.type === 'name')

Expand Down
2 changes: 1 addition & 1 deletion src/core/enhance-whitepaper-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export function enhanceWhitepaperConfig(
): WhitepaperConfig {
const result: WhitepaperConfig = {}
for (const key in config) {
result[key] = config[key].replace(/\[platform\]/, platform)
result[key] = config[key].replace(/\[platform\]/g, platform)
}
return result
}
6 changes: 3 additions & 3 deletions src/core/style-dictionary-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ export function createStyleDictionaryConfig({ sources, entry, platform, output }
...file,
// Replace placeholders for multiple themes and platforms.
destination: file.destination
.replace(/\[entry\]/, entry)
.replace(/\[platform\]/, platform)
.replace(/\[entry\]/g, entry)
.replace(/\[platform\]/g, platform)
// Remove common level, because is root.
.replace(/common\/?/, ''),
.replace(/common\/?/g, ''),
}))
acc[key] = target
return acc
Expand Down

0 comments on commit 71c3759

Please sign in to comment.