1

When i load my fonts with @font-face trough the /templates/ folder, I get these errors:

Failed to decode downloaded font: <URL>
OTS parsing error: Failed to convert WOFF 2.0 font to SFNT
OTS parsing error: incorrect file size in WOFF header
DevTools failed to parse SourceMap: http://crafttest.test/assets/css/css.css.map
OTS parsing error: prep: table overruns end of file

However, if I put the fonts in the /public/ folder they work perfectly. What my question is, is the bad practice to put them there, and why is it throwing these errors in the /templates/ folder?

Also: it's not a wrong url issue, tried changing it, and got a 404.

1 Answer 1

1

You should put your site's assets (images, CSS, fonts, etc.) in your site's public HTML folder.

If you put them into Craft's templates folder, then not only will you invoke Craft/PHP overhead when trying to serve those files (which will be significant instead of having your web server serve them directly), but "bad things" can happen when PHP tries to serve them (like you've discovered).

2
  • Okay, thank you! By assets, do u mean css and js as well? because those work well in the templates folder so it seems!
    – Mathieu
    Commented Mar 31, 2018 at 7:30
  • Those might work there, but still not recommended. :)
    – Brad Bell
    Commented Mar 31, 2018 at 21:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.