Invalid src:url for font-face when building a library
See original GitHub issueVersion
3.0.1
Reproduction link
https://github.com/qspoerri/vue-cli-font
Node and OS info
Yarn 1.6.0 / Node 8.11.3 / Windows 7 professional
Steps to reproduce
run yarn build-lib to generate a library build
What is expected?
The font-face’s src:url should be set correctly.
What is actually happening?
When generating a library containing fonts, the dist directory has the following structure:
.
-- fonts
| -- FiraSans-Bold.bf0aaa9c.woff
| -- FiraSans-Book.6d4e4a15.woff
| -- FiraSans-Light.29430787.woff
|-- img
| -- logo.82b9c7a5.png
-- logo.82b9c7a5.png
-- myLib.common.js
-- myLib.css
-- myLib.umd.js
Unfortunately, in myLib.css the urls for the font-faces seems incorrect moving to the parent directory:
@font-face{font-family:FiraSans-Book;font-style:normal;font-weight:400;src:url(../fonts/FiraSans-Book.6d4e4a15.woff)}
Therefore, when using the library the font-face is not loaded correctly.
The problem occured when I was trying to create a library of shared components to be reused across serveral different application.
For consistency, the fonts should be included in the library
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (6 by maintainers)
Top Results From Across the Web
font-face - CSS: Cascading Style Sheets - MDN Web Docs
Chrome Edge
@font‑face Full support. Chrome1. Toggle history Full support...
OpenType CBDT and CBLC rendering Full support. Chrome66. Toggle history Full support...
OpenType COLRv0 rendering Full...
Read more >Overriding @font-face src URL? - css - Stack Overflow
The solution is to be VERY CAREFUL when overriding the @font-face, making sure to provide all of the same formats used in the...
Read more >Best practices for fonts - web.dev
This article discusses performance best practices for fonts. There are a variety of ways in which web fonts impact performance:.
Read more >How to Add Custom Fonts in WordPress - WPBeginner
I just want to be able to use my font for my Headers. What am I doing wrong here? For this tutorial to...
Read more >Chapter 6: Using fonts in pdfHTML - iText Knowledge Base
The "iText core" library supports Type1 fonts ( . ... in that last sentence means that you don't have to embed these fonts...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@yyx990803 can you release this bug fix? I’m also having a library who’s font is broken now 😂
Bam, and then why not go straight to 3.0.3 😄
So the change wasn’t in there although it got commited before 3.0.1? Crazy! Just when I think I started to understand Git 😄