Skip to content

Commit

Permalink
add line-height to glyph's container
Browse files Browse the repository at this point in the history
  • Loading branch information
odedniv committed Mar 17, 2017
1 parent 9188eb7 commit 0298e0c
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/fontcustom/generator/template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -181,13 +181,24 @@ def woff_base64
Base64.encode64(File.binread(File.join(woff_path))).gsub("\n", "")
end

def glyph_container_selectors
output = @glyphs.map do |name, value|
@options[:css_selector].sub("{{glyph}}", name.to_s)
end
output.join ",\n"
end

def glyph_selectors
output = @glyphs.map do |name, value|
@options[:css_selector].sub("{{glyph}}", name.to_s) + ":before"
end
output.join ",\n"
end

def glyph_container_properties
%Q| line-height: 1;|
end

def glyph_properties
%Q| display: inline-block;
font-family: "#{font_name}";
Expand Down
5 changes: 5 additions & 0 deletions lib/fontcustom/templates/_fontcustom-rails.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,9 @@
<%= glyph_properties %>
}

[data-icon],
<%= glyph_container_selectors %> {
<%= glyph_container_properties %>
}

<%= glyphs %>
5 changes: 5 additions & 0 deletions lib/fontcustom/templates/_fontcustom.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@
<%= glyph_properties %>
}

[data-icon],
<%= glyph_container_selectors %> {
<%= glyph_container_properties %>
}

<%= glyphs %>
<% @glyphs.each do |name, value| %>
$font-<%= font_name.gsub(/[^\w\d_]/, '-') %>-<%= name.to_s %>: "\<%= value[:codepoint].to_s(16) %>";<% end %>
5 changes: 5 additions & 0 deletions lib/fontcustom/templates/fontcustom-preview.html
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,11 @@
<%= glyph_properties %>
}

[data-icon],
<%= glyph_container_selectors %> {
<%= glyph_container_properties %>
}

<%= glyphs %>
</style>

Expand Down
5 changes: 5 additions & 0 deletions lib/fontcustom/templates/fontcustom.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,9 @@
<%= glyph_properties %>
}

[data-icon],
<%= glyph_container_selectors %> {
<%= glyph_container_properties %>
}

<%= glyphs %>

0 comments on commit 0298e0c

Please sign in to comment.