** EDIT **
Nah, the problem is the css2 api who use wght@500:
so i must escape the @ and : with %40 and %3B and now its fixed.
but someone told me its better to use gatsby plugin typeface, and it slightly improved my site performance. Thanks all
**
I'm new to GatsbyJS and I'm trying to modify TaniaRascia's static blog template, the system works fine. But I cannot import google fonts in my SCSS file. I see this error on her site too. Any solutions?
The Code :
/*! Primitive
by Tania Rascia */
@import url(https://fonts.googleapis.com/css2?family=Inter:wght@500;600;700&display=swap);
@import url(https://fonts.googleapis.com/css?family=Roboto+Mono);
// Configuration
@import 'base/variables';
@import 'base/mixins';
The Error in Console :
Refused to apply style from '``<SITE_URL>/url``(https://fonts.googleapis.com/css2?family=Inter:wght@500' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.
Instead of importing the css from url, it seems the browser read it as a link from my local directory.
I've tried solutions from the Internet such as :
- #import 'https://....' < this one produces error when i ran gatsby build
- @import url("https://...'
- @import url('https://...'
And 2 of them produces same error "Refused to apply style from...."
Any solutions? Thanks