0.0.7 • Published 11 months ago

v9helper-babel-plugin-tokens v0.0.7

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

Babel plugin to identify @fluentui/react-northstar tokens in makeStyles call and transform it into @fluentui/react-components tokens.

import { transformTokensPlugin } from "v9helper-babel-plugin-tokens";

const result = Babel.transform(
  `
export const useStyles = makeStyles({
  root: {
    color: colorSchemeDefault.foreground,
    fontWeight: fontWeightRegular
  }
});
`,
  {
    filename: "styles.ts",
    plugins: [[transformTokensPlugin]],
  }
).code;

result will be:

export const useStyles = makeStyles({
  root: {
    color: tokens.colorNeutralForeground1,
    fontWeight: tokens.fontWeightRegular,
  },
});