Skip to content
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

Closed
reduxdj opened this issue Jan 20, 2017 · 3 comments
Closed

Please provide more examples of loading fonts... #158

reduxdj opened this issue Jan 20, 2017 · 3 comments

Comments

@reduxdj
Copy link

reduxdj commented Jan 20, 2017

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

@ali
Copy link

ali commented Feb 27, 2017

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?

@Jeremboo
Copy link

Jeremboo commented Mar 8, 2017

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.

@reduxdj
Copy link
Author

reduxdj commented Mar 29, 2017

Thanks so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants