淘先锋技术网

首页 1 2 3 4 5 6 7

使用导入的本地字体但字体不起作用,并且在浏览器控制台中有一个警告说:

postcss-import-parser:在& quot@从& quot。/sakal . TTF & quot;"

当main.css为:

@tailwind base;
@tailwind components;
@tailwind utilities;
@import sakal from "./sakal.ttf";

* {
  @apply font-sakal !important; 
  font-family: 'Amiri', serif;
}

而tailwind.config.js是:

module.exports = {
  mode: 'jit',
  purge: ['./src/**/*.{js,ts,jsx,tsx}'],
  darkMode: false,
  theme: {
    fontSize: {
      xs: '0.75rem',
      sm: '0.875rem',
      base: '1rem',
      lg: '1.125rem',
      xl: '1.25rem',
      '2xl': '1.5rem',
      '3xl': '1.875rem',
      '4xl': '2.25rem',
      '5xl': '3rem',
      '6xl': '4rem',
    },
    extend: {
      fontFamily: {
        sakal: ['sakal']
      },
...

i

试图安装下一个/字体和导入谷歌字体不工作

main.css:

@tailwind base;
@tailwind components;
@tailwind utilities;
  @import url('https://fonts.googleapis.com/css2?family=Amiri:ital,wght@0,400;0,700;1,400;1,700&display=swap');

* {
  @apply font-amiri !important;
}