Archived topic
Issue with local fonts - MIME type ('text/html') is not a supported MIME type
1 reply · Started by kickpoint on June 3, 2021
Hi,
I am trying to add the font "Winner Extended Bold". I've followed the instructions for adding a local font here: https://docs.generatepress.com/article/adding-local-fonts/ And I'm getting this console error: "Refused to apply style from 'https://exporodeo.wpengine.com/wp-admin/admin-ajax.php?action=ame_branding_output_admin_bar_css&hash=af1d2fef79680016&ver=5.7.2' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled."
Here's my style.css:
/* winner-extended - latin */
@font-face {
font-family: 'Winner Extended Bold';
font-style: bold;
/* font-weight: 400; */
/* src: url('../fonts/abel-v12-latin-regular.eot'); */
/* IE9 Compat Modes */
src: local(''),
/* url('../fonts/abel-v12-latin-regular.eot?#iefix') format('embedded-opentype'), */
/* IE6-IE8 */
url('https://exporodeo.wpengine.com/wp-content/uploads/2021/06/WinnerExtendedBold_font.woff2') format('woff2'), /* Super Modern Browsers */
url('https://exporodeo.wpengine.com/wp-content/uploads/2021/06/WinnerExtendedBold_font.woff') format('woff'), /* Modern Browsers */
/* url('../fonts/abel-v12-latin-regular.ttf') format('truetype'), */
/* Safari, Android, iOS */
/* url('../fonts/abel-v12-latin-regular.svg#Abel') format('svg'); */
/* Legacy iOS */
}
And here's my functions.php:
add_filter( 'upload_mimes', function( $mimes ) {
$mimes['woff'] = 'application/x-font-woff';
$mimes['woff2'] = 'application/x-font-woff2';
$mimes['ttf'] = 'application/x-font-ttf';
$mimes['svg'] = 'image/svg+xml';
$mimes['eot'] = 'application/vnd.ms-fontobject';
return $mimes;
} );
add_filter( 'generate_typography_default_fonts', function( $fonts ) {
$fonts[] = 'Winner Extended Bold';
return $fonts;
} );
Do you know what might be going on here?
Thanks!
Hi there,
First, Can you try cleaning up the CSS?
@font-face {
font-family: 'Winner Extended Bold';
font-style: bold;
src: local('Winner Extended Bold'),
url('https://exporodeo.wpengine.com/wp-content/uploads/2021/06/WinnerExtendedBold_font.woff2') format('woff2'), /* Super Modern Browsers */
url('https://exporodeo.wpengine.com/wp-content/uploads/2021/06/WinnerExtendedBold_font.woff') format('woff'), /* Modern Browsers */
}
As for the PHP part:
Does this part work?
add_filter( 'generate_typography_default_fonts', function( $fonts ) {
$fonts[] = 'Winner Extended Bold';
return $fonts;
} );
To be sure if the PHP codes are actually running. I see nothing wrong with the PHP part so it's strange that the filter doesn't work.
If there's server-sided page caching, can you purge it? Let us know.