node package manager
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »


google-fonts experimental


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



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



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:

    '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.