-
-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Please provide more examples of loading fonts... #158
Comments
hi @reduxdj. I've been able to use stylus-loader with web fonts. If you post some more info about the errors you're running into + your config maybe I can point you in the right direction? |
Hi @reduxdj, I have a mixin inspired by the Emmanuel Beziat's codepen to load webfonts correctly // WEB FONT
// Ex:
// fontPath = "../assets/fonts/";
// webfont("Avenir", fontPath + "Avenir/AvenirLTStd-Roman", 300, normal, otf)
webfont(family, fileUrl, font-weight = false, font-style = false, formats = eot woff2 woff truetype svg)
@font-face
fonts = ()
font-family family
if eot in formats
push(fonts, 'url("' + fileUrl + '.eot?iefix") format("emebedded-opentype")')
if woff2 in formats
push(fonts, 'url("' + fileUrl + '.woff2") format("woff2")')
if woff in formats
push(fonts, 'url("' + fileUrl + '.woff") format("woff")')
if opentype in formats || otf in formats
push(fonts, 'url("' + fileUrl + '.otf") format("opentype")')
if truetype in formats || ttf in formats
push(fonts, 'url("' + fileUrl + '.ttf") format("truetype")')
if svg in formats
push(fonts, 'url("' + fileUrl + '.svg#' + family + '") format("svg")')
src unquote(join(", ", fonts))
if font-weight
font-weight font-weight
if font-style
font-style font-style
Hope it helps you. |
Thanks so much! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is a point of confusion, no matter what i do, i get errors trying to load fonts.... seems like it's a common issue with webpack and stylus
The text was updated successfully, but these errors were encountered: