如何在tailwindcss中从谷歌字体添加自定义字体?

时间:2021-06-25 01:26:53

标签: css tailwind-css

enter image description here我按照 YouTube 上的说明操作,但我无法使用字体系列“nunito”。我将 @import 放在“src”文件夹内的 CSS 文件中,并在终端中运行“npm run(脚本名称)”,但没有任何效果。

module.exports = {
  purge: [],
  darkMode: false, // or 'media' or 'class'
  theme: {
    extend: {
      fontFamily: {
        nunito: ["Nunito"], // ! find out why this fontFamily still not register to the styles.css inside the public -o output folder.
      },
      colors: {
        // THIS IS THE ADDITIONAL COLOR STYLES
        primary: "#FF6363",
        secondary: {
          100: "#E2E2D5",
          100: "#888883",
        },
      },
    },
  },
  variants: {
    extend: {},
  },
  plugins: [],
};

1 个答案:

答案 0 :(得分:1)

Based on their docs 您可能已经声明了键错误,您错过了 Nunito 键上的单引号。应该是:'nunito': ['Nunito']