Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nuxt.js: Include font files: use /static or /assets

Tags:

I know some posts in the nuxt.js github repo cover this a bit, but I would like to know what is the correct way to use font-files in nuxt.js.

So far we had them in the /static/fonts directory, but other people use assets to store the font files. What are the differences? Is one of the options better and if so, why?

Also there are different ways to include them. Would a path like this be correct:

@font-face {   font-family: 'FontName';   font-weight: normal;   src: url('~static/fonts/font.file.eot'); /* IE9 Compat Mode */   src: url('~static/fonts/font.file.woff') format('woff'),        url('~static/fonts/font.file.otf') format('otf'),        url('~static/fonts/font.file.eot') format('eot'); } 

Thanks for some clarification here :D. cheers

J

like image 338
Merc Avatar asked Jun 04 '18 07:06

Merc


1 Answers

it's very well explained on the official doc: https://nuxtjs.org/guide/assets/

assets\ is reserved for assets to be processed (eg. concat css with webpack)

static\ is useful to expose all static files from the root url (static\img\test.jpg => http://example.fr/img/test.jpg), without any process

like image 86
Nicolas Pennec Avatar answered Sep 29 '22 09:09

Nicolas Pennec