Skip to content
This repository was archived by the owner on Sep 30, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
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
5 changes: 5 additions & 0 deletions .changeset/famous-years-destroy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@shopify/polaris-migrator': patch
---

Updated `styles-tokenize-font` to ignore `@font-face` at-rules
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type {FileInfo, API, Options} from 'jscodeshift';
import postcss, {Plugin} from 'postcss';
import postcss, {Plugin, AtRule} from 'postcss';
import valueParser from 'postcss-value-parser';
import {toPx} from '@shopify/polaris-tokens';

Expand Down Expand Up @@ -41,6 +41,14 @@ const plugin = (options: PluginOptions = {}): Plugin => {
// @ts-expect-error - Skip if processed so we don't process it again
if (decl[processed]) return;

if (
decl.parent &&
decl.parent.type === 'atrule' &&
(decl.parent as AtRule).name === 'font-face'
) {
return;
}

const handlers = {
'font-size': handleFontSize,
'font-weight': handleFontWeight,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
@font-face {
font-family: 'Custom Font';
font-weight: 400;
}

.font-size {
// LENGTHS
font-size: 12px;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
@font-face {
font-family: 'Custom Font';
font-weight: 400;
}

.font-size {
// LENGTHS
font-size: var(--p-font-size-75);
Expand Down