A small helper library for embedding Google Fonts on your page
JavaScript HTML
Switch branches/tags
Nothing to show
Clone or download
Latest commit 4667e7e Jan 31, 2016
Permalink
Failed to load latest commit information.
LICENSE.md first commit Sep 21, 2013
README.md first commit Sep 21, 2013
demo.js first commit Sep 21, 2013
index.html first commit Sep 21, 2013
index.js Merge pull request #2 from chadrien/patch-1 Feb 1, 2016
package.json 1.0.0 Feb 1, 2016

README.md

google-fonts experimental

google-fonts

A small helper library for embedding Google Fonts onto your page.

Usage

fonts(list)

Given a list of fonts (see below), returns a string like this one (minus the whitespace) that you can include in a template:

<link
  href='http://fonts.googleapis.com/css?family=Cantora+One|Ropa+Sans:400,400italic'
  rel='stylesheet'
  type='text/css'
>

fonts.add(list)

Given the same list of fonts, you can add them directly to your page using this method (assuming you're using something like browserify).

Useful for quick demos/prototypes, but if you want to avoid the flash of unstyled text then stick with pasting their snippet in your HTML.

The list should be formatted like so:

fonts.add({
    'Ropa Sans': ['400', '400italic']
  , 'Source Sans Pro': true
  , 'Raleway': 400
})

Where each key is a font name, and each value is an array of styles to include. You can also pass a single style, or true to include all of the available ones for that font.