I currently have a structure as below:
stylesheet.css
fonts/webfont-1.woff
When using @font-face in the stylesheet.css,
src: url('fonts/webfont-1.woff');
does not load the font.
When I move the webfont-1.woff over to the same folder as stylesheet.css however, and change the @font-face reference in the stylesheet.css to:
src: url(webfont-1.woff');
The font works completely fine. I am doing this through the Shopify liquid platform so I’m not sure if that affects anything, but help would be greatly appreciated. I’d like the fonts to be in a subfolder for organization, but it doesn’t load when I try to do so.
Thanks.
3
Answers
Looks like the limitation comes from Shopify. Sorry about that!
Did you try with an absolute path with adding a slash ‘/’ in front ‘fonts’ folder name ?
like this –>
src: url('/fonts/webfont-1.woff');
Just to confirm, you can’t have a fonts folder in Shopify. You will have to store the files in the assets folder.