From 69883ed91d5533a103bb62c4a2627b1f0975339b Mon Sep 17 00:00:00 2001 From: Naman Goel Date: Tue, 5 Dec 2023 12:08:35 -0800 Subject: [PATCH] Fix: Default useRemForFontSize to false (#29) --- apps/docs/docs/api/configuration/babel-plugin.mdx | 2 +- .../stylex-transform-value-normalize-test.js | 11 ++++++++++- packages/babel-plugin/src/utils/state-manager.js | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/apps/docs/docs/api/configuration/babel-plugin.mdx b/apps/docs/docs/api/configuration/babel-plugin.mdx index 4ff186cc..14885f90 100644 --- a/apps/docs/docs/api/configuration/babel-plugin.mdx +++ b/apps/docs/docs/api/configuration/babel-plugin.mdx @@ -58,7 +58,7 @@ Prefix to applied to every generated className. ### `useRemForFontSize` ```ts -useRemForFontSize: boolean // Default: true +useRemForFontSize: boolean // Default: false ``` Should `px` values for `fontSize` be converted to `rem`? diff --git a/packages/babel-plugin/__tests__/stylex-transform-value-normalize-test.js b/packages/babel-plugin/__tests__/stylex-transform-value-normalize-test.js index 2f1aa88b..8c6a4438 100644 --- a/packages/babel-plugin/__tests__/stylex-transform-value-normalize-test.js +++ b/packages/babel-plugin/__tests__/stylex-transform-value-normalize-test.js @@ -20,7 +20,16 @@ function transform(source, opts = {}) { parserOpts: { flow: 'all', }, - plugins: [[stylexPlugin, { runtimeInjection: true, ...opts }]], + plugins: [ + [ + stylexPlugin, + { + runtimeInjection: true, + useRemForFontSize: true, + ...opts, + }, + ], + ], }).code; } diff --git a/packages/babel-plugin/src/utils/state-manager.js b/packages/babel-plugin/src/utils/state-manager.js index 28947cef..c0e332b6 100644 --- a/packages/babel-plugin/src/utils/state-manager.js +++ b/packages/babel-plugin/src/utils/state-manager.js @@ -88,7 +88,7 @@ export default class StateManager { definedStylexCSSVariables: (options: $FlowFixMe).definedStylexCSSVariables ?? {}, genConditionalClasses: !!(options: $FlowFixMe).genConditionalClasses, - useRemForFontSize: (options: $FlowFixMe).useRemForFontSize ?? true, + useRemForFontSize: !!(options: $FlowFixMe).useRemForFontSize, styleResolution: (options: $FlowFixMe).styleResolution ?? 'application-order', unstable_moduleResolution: