Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to import Google Fonts on a Stylus file?

I'd like to know how can I import Google Fonts from a stylus (.styl) file. I tried:

@import url(http://fonts.googleapis.com/css?family=Overlock:400,700,400italic,700italic|Calligraffitti)

...but it failed on my console when compiling with the following error:

Potentially unhandled rejection [2] ParseError: C:\Users\Coutinho\Documents\GitHub\bespoke-theme-fancy\lib\theme.styl:5
   1| // Bespoke Classes: https://github.com/markdalgleish/bespoke-classes
   2| // Stylus: http://learnboost.github.io/stylus
   3|
   4| @import 'normalizecss/normalize.css'
 > 5| @import url(http://fonts.googleapis.com/css?family=Overlock:400,700,400italic,700italic|Calligraffitti)
   6|
   7| $font-family-serif 'Calligraffitti', cursive
   8| $font-family-sans 'Overlock', Helvetica, sans-serif

expected ")", got "selector |Calligraffitti)"

Thanks!

like image 633
fegemo Avatar asked Aug 20 '14 18:08

fegemo


People also ask

Can you use Google Fonts in CodePen?

#Google FontsFind the one you want and click Quick Use. Click the @import tab and copy the code it gives you. Put that the the top of your CSS in CodePen. Then use the CSS they give you right below that with the font-family name on any selectors you want to use that font on.

How do I install downloaded Google Fonts?

Manually Download Google FontsOpen the drawer at the bottom of the screen where your selection is saved. Click the “Download” icon on the upper right corner of the selection drawer. Once downloaded, extract the zip file. Open the font folder, right-click on the font and choose “Install.”

Can I import all Google Fonts?

You can load multiple google font's but you have to define font families for every font you want to import. You need to separate each font using '|' character.


1 Answers

Wrap the url in quotes: @import url('http://fonts.googleapis.com/css?family=Overlock:400,700,400italic,700italic|Calligraffitti')

like image 136
Panya Avatar answered Oct 04 '22 08:10

Panya