使用Vue Cli 3链接到字体

问题描述 投票:0回答:1

我正在尝试将我的@ font-face链接到由vue cli 3使用vue 2创建的项目上的字体文件夹(assets / fonts)

arborescence

资产/上海社会科学院/公共事业/ 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

资产/上海社会科学院/ 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个回答
1
投票

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

它正在与format('woff')合作

© www.soinside.com 2019 - 2024. All rights reserved.