不在 2 导入规则中包含 google 字体的原因是什么

What is the reason(s) NOT to include google fonts in 2 import rule

我看到一些争论,无论是明确的还是暗示的,你不应该通过@import 规则在 style.css 中导入字体。

您不应该这样做的主要原因是什么?

有几个原因

  • 比推荐的使用方式慢 wp_enqueue_scripts

  • 子主题和插件无法删除这些样式

  • 无法设置依赖,无法条件加载样式

  • 覆盖这些样式有时需要使用 !important,这在 CSS 中并不推荐。