theme-json-to-scss
v1.1.0
Published
Convert WordPress theme.json settings into SCSS variables.
Readme
theme-json-to-scss
Convert WordPress theme.json settings into SCSS variables.
Usage
npx theme-json-to-scss theme.json src/scss/_theme-vars.scssYou can also print to stdout:
npx theme-json-to-scss theme.json --stdoutSet a custom base font size for generated REM helper variables:
npx theme-json-to-scss theme.json --base-font-size 18pxProgrammatic usage accepts the same option:
const { convertThemeJsonToScss } = require("theme-json-to-scss");
const scss = convertThemeJsonToScss(themeJson, {
baseFontSize: "18px",
});Generated Variables
The CLI currently converts:
settings.color.paletteto$color-<slug>settings.typography.fontFamiliesto$font-<slug>settings.typography.fontSizesto$font-size-<slug>settings.layout.contentSizeto$content-narrowsettings.layout.wideSizeto$content-widesettings.customto$<setting>
It also adds $font-base: 16px; for REM helper mixins, or the value passed with --base-font-size.
