jmjuanes/siimple

Bug: Fonts do not work with `useCssVariables`.

Rodielm opened this issue · 1 comments

Describe the issue

It seems that using useCssVariables fonts do not work.

To reproduce

Add Roboto, Montserrat fonts to the index.html

<html lang="en" data-color-mode="dark">
<head>
  <meta charset="UTF-8" />
  <link rel="icon" type="image/svg+xml" href="/vite.svg" />
  <link rel="preconnect" href="https://fonts.googleapis.com">
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
  <link
    href="https://fonts.googleapis.com/css2?family=Montserrat:wght@400;600;800&family=Roboto:wght@400;500;800&display=swap"
    rel="stylesheet">
    <link rel="stylesheet" href="/siimple-beta.css">
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>Vite + React</title>
</head>
<body>...</body
</html>

Use this config

import ice from '@siimple/preset-ice'
import dark from '@siimple/preset-dark'

export default {
  useColorModes: true,
  useCssVariables: true,
  useColorModesMediaQuery: false,
  useRootStyles: true,
  useBorderBox: true,
  prefix: '',
  ...ice,
  colors: {
    ...ice.colors,
  },
  colorModes: {
    dark: { ...dark.colors },
  },
  fonts: {
    body: ['Roboto', 'sans-serif'],
    heading: ['Montserrat', 'sans-serif'],
    code: ['monospace'],
  },
}

Run this command: npx siimple -c ./siimple.config.js -o ./siimple.css

Screenshots

No response

What browser(s) are you seeing the problem on?

Chrome

What version of siimple are you using?

4.3.0

Additional context

No response

Hi @Rodielm. This seems that is a typo in the configuration example, fonts should be specified as a single string and not as an array. This should work:

export default {
    fonts: {
        body: "'Roboto',sans-serif",
        heading: "'Montserrat',sans-serif",
        code: "monospace",
    },
    // ...other configuration
};

You can try it on this playground.