lib/web_font/downloader.rb in web_font-0.1.12 vs lib/web_font/downloader.rb in web_font-0.1.13
- old
+ new
@@ -9,13 +9,13 @@
# Download font from Google and save it locally
#
# Returns nothing
def download(font_family, destination_path, from_cache = true)
- item = finder.find(font_family)
- return if item.empty?
-
downloaded_fonts = []
+ item = finder.find(font_family)
+ return downloaded_fonts if item.empty?
+
font_family = item['family'].gsub(/\s/, '-')
item['files'].each do |variant, url|
filename = "#{font_family}-#{variant}#{File.extname(url)}"
font_path = File.join(destination_path, filename)