Skip to content

Commit d079427

Browse files
committed
add line-height to glyph's container
1 parent 4ff2fbf commit d079427

File tree

5 files changed

+31
-0
lines changed

5 files changed

+31
-0
lines changed

lib/fontcustom/generator/template.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,13 +189,24 @@ def woff_base64
189189
Base64.encode64(File.binread(File.join(woff_path))).gsub("\n", "")
190190
end
191191

192+
def glyph_container_selectors
193+
output = @glyphs.map do |name, value|
194+
@options[:css_selector].sub("{{glyph}}", name.to_s)
195+
end
196+
output.join ",\n"
197+
end
198+
192199
def glyph_selectors
193200
output = @glyphs.map do |name, value|
194201
@options[:css_selector].sub("{{glyph}}", name.to_s) + @pseudo_element
195202
end
196203
output.join ",\n"
197204
end
198205

206+
def glyph_container_properties
207+
%Q| line-height: 1;|
208+
end
209+
199210
def glyph_properties
200211
%Q| display: inline-block;
201212
font-family: "#{font_name}";

lib/fontcustom/templates/_fontcustom-rails.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,9 @@
1111
<%= glyph_properties %>
1212
}
1313

14+
[data-icon],
15+
<%= glyph_container_selectors %> {
16+
<%= glyph_container_properties %>
17+
}
18+
1419
<%= glyphs %>

lib/fontcustom/templates/_fontcustom.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@
1111
<%= glyph_properties %>
1212
}
1313

14+
[data-icon],
15+
<%= glyph_container_selectors %> {
16+
<%= glyph_container_properties %>
17+
}
18+
1419
<%= glyphs %>
1520
<% @glyphs.each do |name, value| %>
1621
$font-<%= font_name.gsub(/[^\w\d_]/, '-') %>-<%= name.to_s %>: "\<%= value[:codepoint].to_s(16) %>";<% end %>

lib/fontcustom/templates/fontcustom-preview.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,11 @@
130130
<%= glyph_properties %>
131131
}
132132

133+
[data-icon],
134+
<%= glyph_container_selectors %> {
135+
<%= glyph_container_properties %>
136+
}
137+
133138
<%= glyphs %>
134139
</style>
135140

lib/fontcustom/templates/fontcustom.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,9 @@
1111
<%= glyph_properties %>
1212
}
1313

14+
[data-icon],
15+
<%= glyph_container_selectors %> {
16+
<%= glyph_container_properties %>
17+
}
18+
1419
<%= glyphs %>

0 commit comments

Comments
 (0)