【问题标题】:Link to fonts with Vue Cli 3使用 Vue Cli 3 链接到字体
【发布时间】:2019-02-10 07:27:32
【问题描述】:

我正在尝试将我的@font-face 链接到我在 vue cli 3 和 vue 2 创建的项目中的字体文件夹(资产/字体)

arborescence

assets/sass/utilities/fonts.sass

@font-face
  font-family: 'NeuzeitGroteskBold'
  src: url($font-path + 'NeuzeitGroteskBold/neuzeitgro-bol-webfont.eot')
  src: url($font-path + 'NeuzeitGroteskBold/neuzeitgro-bol-webfont.eot?#iefix') format('embedded-opentype'),
       url($font-path + 'NeuzeitGroteskBold/neuzeitgro-bol-webfont.woff2') format('font-woff2'),
       url($font-path + 'NeuzeitGroteskBold/neuzeitgro-bol-webfont.woff') format('font-woff'),
       url($font-path + 'NeuzeitGroteskBold/neuzeitgro-bol-webfont.ttf') format('font-truetype')
  font-weight: normal
  font-style: normal

assets/sass/app.sass

@charset "utf-8"
$font-path: '~@/assets/fonts/'
@import 'utilities/all'

我已经尝试过 ../../fonts 或 assets/fonts,将其放入公用文件夹或使用 font-url 但没有任何效果...

我没有错误信息,只是字体不工作

【问题讨论】:

    标签: javascript vue.js sass vue-cli-3


    【解决方案1】:

    好的,这是因为用于修复另一个错误的format('font-woff') 不正确

    它正在使用format('woff')

    【讨论】:

      猜你喜欢
      • 2018-12-26
      • 2019-08-20
      • 2021-06-12
      • 2019-06-12
      • 2021-04-28
      • 2019-04-20
      • 2018-01-27
      • 1970-01-01
      • 2019-03-31
      相关资源
      最近更新 更多