I am doing assets pre-compile, and running the application in production mode. After compilation when I load the my index page I got followings warnings in the chrome consol
If other answers didn't work try:
check .htaccess file
# Fonts
# Add correct content-type for fonts
AddType application/vnd.ms-fontobject .eot
AddType application/x-font-ttf .ttf
AddType application/x-font-opentype .otf
AddType application/x-font-woff .woff
AddType application/x-font-woff2 .woff2
AddType image/svg+xml .svg
clear server cache
try
@font-face {
font-family: 'icomoon';
src: asset-url('icomoon.eot');
src: asset-url('icomoon.eot?#iefix') format('embedded-opentype'),
asset-url('icomoon.ttf') format('truetype'),
asset-url('icomoon.woff') format('woff'),
asset-url('icomoon.svg#icomoon') format('svg');
font-weight: normal;
font-style: normal;
}
and rename your file to application.css.scss
I had same problem when I opened and saved .woff
and .woff2
files through Sublime Text with EditorConfig
option end_of_line = lf
.
I just copied files to font folder without opening them into Sublime and problem was solved.
Just state format at @font-face as following:
@font-face {
font-family: 'Some Family';
src: url('/fonts/fontname.ttf') format('ttf'); /* and this for every font */
}
If your are using Chrome, try adding an opentype (OTF) version of your font as shown below:
...
url('icomoon.otf') format('opentype'),
...
Cheers!
I am using ASP.NET with IIS and it turns out I just needed to add the MIME-type to IIS: '.woff2' / 'application/font-woff'