How to import svg and fonts?
See original GitHub issueHi everyone! This isn’t a bug. But I’m a bit confused.
This is my project structure:

Font issue:
When I import a font with url in my sass file an error is shown in the build:
Module not found: Error: Can't resolve '../../fonts/BebasNeueBook.woff2'
Then in a .scss file (styles/base/reset.scss):
@font-face {
font-family: 'BebasNeueBook';
src: url('../../fonts/BebasNeueBook.woff2') format('woff2');
}
SVG issue:
I use the svg as follow:
<svg class="icon-menu">
<use xlink:href="/icons/icons.svg#icon-menu"></use>
</svg>
But I can show this error in the dev tools console:
vue.esm.js?65d7:5819 GET http://localhost:9080/icons/icons.svg

Tell me about your development environment.
- Node version: 8.0.0
- NPM version: 5.3.0
- vue-cli version: 2.8.2
- Operating System: MacOS 10.12.6
Thanks for any help you can give me! Regards!
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
How to Use Fonts in SVG - Vecta.io
The hard way. Locate the .ttf file for your font; Go to an online converter and convert it to base64; Embed into your...
Read more >How do I use a custom font in an SVG image on my site?
That's an example for the following font: https://fonts.googleapis.com/css?family=Fredoka%20One Open visit the font page and copy everything ...
Read more >SVG fonts - SVG: Scalable Vector Graphics - MDN Web Docs
There are some ingredients required for embedding a font in SVG. Let's show an example declaration (the one from the specification), and explain...
Read more >Custom Font in svg - Stack Overflow
You can change fonts in svgs just as you do in css. <style> @font-face { font-family: font; src: url(font.woff); } svg{ font-family: font, ......
Read more >Understanding and Using SVG Fonts in Photoshop and ...
SVG fonts are a new version of an Open Type format and contain things that fonts have never been able to contain, like...
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

For future Googlers, that’s what worked for me.
/src/assets/fonts@algil
For the font issue, you could try using the
webpackalias with something likeurl(~@/assets/fonts/BebasNeueBook.woff2), where the@provides you a reference to thesrc/directory.As for the SVG issue, you will not be able to use the
xlink:hrefapproach asvue-loaderwon’t treat that as arequirestatement. You could either alt for using a<img>tag, or place your icons within thestatic/directory and access from there.