Jean-Baptiste
Jean-Baptiste

Reputation: 1562

Relative path not working with a custom font

I have an issue trying to call my custom font with a relative path when my code is in production. Everything works fine on my local setup.

Here is my folder organisation

-fonts
--Neil.eot
--Neil.woff
--Neil.ttf
--Neil.svg
-stylesheets
--style.css

And here is the custom font declaration, in style.css

@font-face {
  font-family: "Neil";
  src: url('../fonts/Neil.eot');
  src: url('../fonts/Neil.woff') format('woff'),
       url('../fonts/Neil.ttf') format('truetype'),
       url('../fonts/Neil.svg#Helvetica') format('svg');
  font-weight: normal;
  font-style: normal;
}

I have to use an absolute path to make it work in production. If anybody has a hint.

Upvotes: 1

Views: 718

Answers (1)

Jean-Baptiste
Jean-Baptiste

Reputation: 1562

So, this was not a relative path issue but a cross-origin request error caused by misconfiguration in my wordpress. The website address was different from the wordpress address.

Thanks for taking a look!

Upvotes: 1

Related Questions