fontico 1.2.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +10 -0
- data/lib/fontico/emitters/sprite.rb +1 -1
- data/lib/fontico/helper.rb +2 -2
- data/lib/fontico/icon.rb +6 -0
- data/lib/fontico/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5b63916a176aadaebf800f98fb88b20f58a1bd38652a8ca11a330a25200d7209
|
|
4
|
+
data.tar.gz: 152ec800d410153c87c1b2059a2667d49e2735029aed1fa7959ccaf3304c3ab1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1d313c8e7c57300beb9b0492409f4be57684d5f3c4ffc5c5546d70de335af4d727587fe32093a80de834e7b58b3b388874a940d18f37b3b8809b87c6be17eb89
|
|
7
|
+
data.tar.gz: c2689f5205be4f820dd7fcd5db0789f0aa6385c85cac02cd10c311af7bbb69a2b1e14d1c210acb54c0216b591c085dd9b8b06afa7efc100cea6a534ca6faed60
|
data/README.md
CHANGED
|
@@ -196,6 +196,16 @@ sprite same-origin, or switch to inline mode:
|
|
|
196
196
|
Fontico.inline_sprite = true # then <%= icons_sprite %> in your layout
|
|
197
197
|
```
|
|
198
198
|
|
|
199
|
+
### Symbol ids are namespaced
|
|
200
|
+
|
|
201
|
+
Every `<symbol>` id is `i-` plus the manifest name (`close` is `i-close`,
|
|
202
|
+
`nav.menu` is `i-nav-menu`). An inlined sprite lives in the same document as
|
|
203
|
+
the page, and a bare `id="close"` collides with a `<section id="close">` of
|
|
204
|
+
yours: invalid HTML, an axe `duplicate-id`, `querySelector("#close")` landing
|
|
205
|
+
on the hidden symbol, an anchor `#close` scrolling to it. `icon` and
|
|
206
|
+
`icon_href` write the prefix for you; hand-written markup uses
|
|
207
|
+
`Fontico::Icon::SYMBOL_PREFIX`.
|
|
208
|
+
|
|
199
209
|
## Fonts, and Prawn
|
|
200
210
|
|
|
201
211
|
The `ttf` target exists for **PDF generation**, not the web — Prawn reads
|
|
@@ -15,7 +15,7 @@ module Fontico
|
|
|
15
15
|
|
|
16
16
|
def call
|
|
17
17
|
symbols = @build.map do |icon, body|
|
|
18
|
-
%(<symbol id="#{icon.
|
|
18
|
+
%(<symbol id="#{icon.symbol}" viewBox="0 0 #{@manifest.size} #{@manifest.size}" ) +
|
|
19
19
|
%(fill="none">#{body}</symbol>)
|
|
20
20
|
end
|
|
21
21
|
|
data/lib/fontico/helper.rb
CHANGED
|
@@ -45,7 +45,7 @@ module Fontico
|
|
|
45
45
|
entry = Fontico.manifest[key]
|
|
46
46
|
raise Fontico::Error, "no icon named #{name.inspect} in #{Fontico.manifest_path}" if entry.nil?
|
|
47
47
|
|
|
48
|
-
"#{sprite_path}##{entry.
|
|
48
|
+
"#{sprite_path}##{entry.symbol}"
|
|
49
49
|
end
|
|
50
50
|
|
|
51
51
|
# Embeds the symbol definitions directly, for pages served from a CDN
|
|
@@ -79,7 +79,7 @@ module Fontico
|
|
|
79
79
|
open << "<title>#{ERB::Util.html_escape(title)}</title>" if title
|
|
80
80
|
open << %(<use href=")
|
|
81
81
|
|
|
82
|
-
[open.freeze, %(##{entry.
|
|
82
|
+
[open.freeze, %(##{entry.symbol}"></use></svg>).freeze]
|
|
83
83
|
end
|
|
84
84
|
|
|
85
85
|
def safe(str) = str.respond_to?(:html_safe) ? str.html_safe : str
|
data/lib/fontico/icon.rb
CHANGED
|
@@ -11,5 +11,11 @@ module Fontico
|
|
|
11
11
|
# Sprite symbol ids and the id-namespacing prefix both derive from here,
|
|
12
12
|
# so a rename in the manifest moves them together.
|
|
13
13
|
def key = name.tr(".", "-")
|
|
14
|
+
|
|
15
|
+
# What the <symbol> is called in the sprite. Namespaced: an inlined sprite
|
|
16
|
+
# shares the document with the page, and a bare "close" is also the page's
|
|
17
|
+
# own #close.
|
|
18
|
+
def symbol = "#{Icon::SYMBOL_PREFIX}#{key}"
|
|
14
19
|
end
|
|
20
|
+
Icon::SYMBOL_PREFIX = "i-"
|
|
15
21
|
end
|
data/lib/fontico/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: fontico
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 2.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- nofxx
|
|
@@ -129,7 +129,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
129
129
|
- !ruby/object:Gem::Version
|
|
130
130
|
version: '0'
|
|
131
131
|
requirements: []
|
|
132
|
-
rubygems_version:
|
|
132
|
+
rubygems_version: 4.0.20
|
|
133
133
|
specification_version: 4
|
|
134
134
|
summary: Name icons by intent. Source them from anywhere. Ship one artifact.
|
|
135
135
|
test_files: []
|