Skip to content

Instantly share code, notes, and snippets.

@chrishutchinson
Created May 6, 2017 10:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chrishutchinson/4a9f7bffddfec376e9d71e8666d5955d to your computer and use it in GitHub Desktop.
Save chrishutchinson/4a9f7bffddfec376e9d71e8666d5955d to your computer and use it in GitHub Desktop.
Get the base64 version of a Google Font
const googlefontcssmerge = require('googlefontcssmerge');
const googlefontcss64 = require('googlefontcss64');
const css = require('css');
const url = `http://fonts.googleapis.com/css?family=Open+Sans`;
googlefontcssmerge(url, function(error, style) {
if (error) throw error;
googlefontcss64(style, function(error, style) {
if (error) throw error;
console.log(css.stringify(style));
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment