didierfranc / gatsby-plugin-google-fonts

Bring Google Fonts to Gatsby https://www.gatsbyjs.org/
MIT License
88 stars 18 forks source link

400 error when font family has words starting with lowercase #6

Open joelsaupe opened 6 years ago

joelsaupe commented 6 years ago

It looks like Google will throw a 400 error if the casing doesn't match exactly, and it looks like the format function currently capitalizes every word in the font family. This covers the majority of fonts, but there are many that include non-capitalized words in them that can't be loaded with this plugin.

eg: "Loved by the King" The link generated by Google Fonts is: https://fonts.googleapis.com/css?family=Loved+by+the+King While the link generated by the plugin is: https://fonts.googleapis.com/css?family=Loved+By+The+King

didierfranc commented 6 years ago

We just need to add a white list and a matcher. It's ssred so it won't be a problem.