diff --git a/src/transformers/globalStyle.ts b/src/transformers/globalStyle.ts
index c8414ea6..9dbbbdbe 100644
--- a/src/transformers/globalStyle.ts
+++ b/src/transformers/globalStyle.ts
@@ -23,7 +23,11 @@ const globalifyRulePlugin = (root: pcss.Root) => {
});
if (modifiedSelectors.length === 0) {
- rule.remove();
+ if (rule.parent?.type === 'atrule' && rule.selector === ':global') {
+ rule.replaceWith(...rule.nodes);
+ } else {
+ rule.remove();
+ }
return;
}
diff --git a/test/transformers/globalStyle.test.ts b/test/transformers/globalStyle.test.ts
index e8e742d6..3a8b2201 100644
--- a/test/transformers/globalStyle.test.ts
+++ b/test/transformers/globalStyle.test.ts
@@ -251,5 +251,14 @@ describe('transformer - globalStyle', () => {
'',
);
});
+ it('unwraps :global in @font-face', async () => {
+ const template = ``;
+ const opts = autoProcess();
+ const preprocessed = await preprocess(template, opts);
+
+ expect(preprocessed.toString?.()).toContain(
+ '',
+ );
+ });
});
});