Created
May 24, 2012 00:01
-
-
Save mcasimir/2778541 to your computer and use it in GitHub Desktop.
Google fonts helper for Ruby on Rails
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Gem::Specification.new do |s| | |
s.name = 'google_fonts_helper' | |
s.summary = 'Google fonts helper for Ruby on Rails' | |
s.version = '0.0.1' | |
s.platform = Gem::Platform::RUBY | |
s.files = %w(google_fonts_helper.rb) | |
s.require_path = '.' | |
s.author = 'Maurizio Casimirri' | |
s.email = '[email protected]' | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Mcasimir | |
module GoogleFontsHelper | |
def google_fonts_link_tag(*fonts) | |
families = fonts.map {|f| f.to_s.gsub("_", " ").titleize.gsub(" ", "+")}.join("|") | |
html = <<-STR | |
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=#{families}" type="text/css" /> | |
STR | |
html.html_safe | |
end | |
end | |
end | |
ActionView::Base.send :include, Mcasimir::GoogleFontsHelper |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment