compass-fontcustom 1.1.0 → 1.2.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/CHANGELOG.md +6 -0
- data/README.md +32 -6
- data/compass-fontcustom.gemspec +1 -1
- data/lib/compass/fontcustom/font_importer.rb +1 -1
- data/lib/compass/fontcustom/glyph_map.rb +1 -1
- data/lib/compass/fontcustom/sass_extensions.rb +6 -0
- data/lib/compass/fontcustom/version.rb +1 -1
- data/stylesheets/_fontcustom.scss +1 -1
- data/test/unit/font_importer_test.rb +4 -2
- data/test/unit/glyph_map_test.rb +0 -6
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cb0812751debead28ea3d4591379fee7e0583fbc
|
4
|
+
data.tar.gz: 029b22c2336088adab8a978424fc3010ea114544
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2902fae6a25bde6f8943acecdb39e2ea5dc7d85e4f2a1724c23bc2517cb1ff04b60901ad8f585ef5907e67ef09ff45aab27c47f20eb1f241827dc5008257b406
|
7
|
+
data.tar.gz: 985c8f266cd4c3833e54cedd7c01259893977627a4564c801dc635f74e45274b5baa991459051736c9bc4f69a81719d032fabecdfdfca1255fa16bfb4b136041
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
**1.2.0** Major release
|
4
|
+
|
5
|
+
- Bundles Fontcustom 1.2.0
|
6
|
+
- **Compatibility**: CSS class name and glyph name normalization have been decoupled. See the readme for details.
|
7
|
+
- Extended documentation in the readme.
|
8
|
+
|
3
9
|
**1.1.0** Minor release
|
4
10
|
|
5
11
|
- Bundles Fontcustom 1.1.0
|
data/README.md
CHANGED
@@ -9,7 +9,8 @@ This is my attempt of integrating [Font Custom](http://fontcustom.com) with [Com
|
|
9
9
|
|
10
10
|
## Requirements
|
11
11
|
|
12
|
-
Made for ruby 1.9+. Tested on 1.9.3 and 2.0.0.
|
12
|
+
Made for ruby 1.9+. Tested on 1.9.3 and 2.0.0.
|
13
|
+
You'll need to have fontforge and the [WOFF font toolset](http://people.mozilla.com/~jkew/woff) installed as outlined in the Font Custom [installation instructions](http://fontcustom.com/#installation).
|
13
14
|
|
14
15
|
## Installation
|
15
16
|
|
@@ -35,14 +36,39 @@ You can let Font Custom generate your fonts upon Compass' css compilation:
|
|
35
36
|
@include all-myfont-glyphs;
|
36
37
|
```
|
37
38
|
|
38
|
-
This will
|
39
|
+
This will setup a proper `@font-face` and generate icon classes named `.icon-<font_name>-<glyph_name>` for each glyph.
|
39
40
|
|
40
|
-
|
41
|
+
### Custom class names
|
41
42
|
|
42
|
-
|
43
|
+
You can also use custom class names using the `<font_name>-glyph()` mixin:
|
43
44
|
|
44
|
-
|
45
|
-
|
45
|
+
```css
|
46
|
+
.custom-class-name {
|
47
|
+
@include myfont-glyph(glyph-file-name);
|
48
|
+
}
|
49
|
+
```
|
50
|
+
|
51
|
+
which will result into CSS along the lines of:
|
52
|
+
|
53
|
+
```css
|
54
|
+
.myfont-font, .custom-class-name {
|
55
|
+
font-family: "myfont";
|
56
|
+
}
|
57
|
+
.custom-class-name:before {
|
58
|
+
content: "\f100";
|
59
|
+
}
|
60
|
+
```
|
61
|
+
|
62
|
+
> **Attention**
|
63
|
+
> Generated CSS class names will be normalized and reserved characters removed.
|
64
|
+
> That means if you have a glyph file name of `a_R3ally-eXotic f1Le+Name.svg` the generated class name will be `.icon-myfont-a_R3ally-eXotic-f1Le-Name`.
|
65
|
+
|
66
|
+
## Configuration options
|
67
|
+
|
68
|
+
### Filename hashing
|
69
|
+
|
70
|
+
You can choose to disable file name hashes if you're already using an asset pipeline which handles this for you:
|
71
|
+
Use the `fontcustom_hash` option in `config.rb`
|
46
72
|
|
47
73
|
```ruby
|
48
74
|
compass_config do |config|
|
data/compass-fontcustom.gemspec
CHANGED
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.required_ruby_version = '>= 1.9.3'
|
22
22
|
|
23
23
|
spec.add_dependency "compass"
|
24
|
-
spec.add_dependency "fontcustom", "~> 1.
|
24
|
+
spec.add_dependency "fontcustom", "~> 1.2.0"
|
25
25
|
|
26
26
|
spec.add_development_dependency "bundler", "~> 1.3"
|
27
27
|
spec.add_development_dependency "rake"
|
@@ -69,7 +69,7 @@ module Compass
|
|
69
69
|
raise Compass::SpriteException, %Q{No glyph images were found matching "#{uri}" in the images path. Your current images path is: #{folder}}
|
70
70
|
end
|
71
71
|
|
72
|
-
files.map { |f| File.basename(f)[0..-5]
|
72
|
+
files.map { |f| File.basename(f)[0..-5] }
|
73
73
|
end
|
74
74
|
|
75
75
|
# Returns `Sass::Engine` options with defaults
|
@@ -15,7 +15,7 @@ module Compass
|
|
15
15
|
|
16
16
|
# TODO: improve extraction of aboslute path
|
17
17
|
path = File.dirname glyphs.first
|
18
|
-
glyphs.map! { |file| File.basename(file)[0..-5]
|
18
|
+
glyphs.map! { |file| File.basename(file)[0..-5] }
|
19
19
|
|
20
20
|
new glyphs, path, name, context
|
21
21
|
end
|
@@ -78,6 +78,12 @@ module Compass
|
|
78
78
|
font_url(font_file).value
|
79
79
|
end
|
80
80
|
|
81
|
+
def sanitize_symbol(name)
|
82
|
+
sanitized = name.value.to_s.gsub(/[.+{};]+/, ' ').strip.gsub(/[ ]+/, '-')
|
83
|
+
Sass::Script::String.new sanitized
|
84
|
+
end
|
85
|
+
Sass::Script::Functions.declare :sanitize_symbol, [:name]
|
86
|
+
|
81
87
|
end
|
82
88
|
|
83
89
|
end
|
@@ -18,7 +18,7 @@
|
|
18
18
|
@each $glyph-name in $glyph-names {
|
19
19
|
|
20
20
|
$index: index($glyph-names, $glyph-name);
|
21
|
-
$class_name: "icon-#{$name}-#{$glyph-name}";
|
21
|
+
$class_name: "icon-#{$name}-#{sanitize-symbol($glyph-name)}";
|
22
22
|
|
23
23
|
.#{$class_name} {
|
24
24
|
@if $base-class { @extend #{$base-class}; }
|
@@ -70,6 +70,8 @@ class FontImporterTest < Test::Unit::TestCase
|
|
70
70
|
assert css =~ %r{.#{fontname}-font}, "base font class missing"
|
71
71
|
assert css =~ %r{.icon-#{fontname}-c}i, "icon c css class missing"
|
72
72
|
assert css =~ %r{.icon-#{fontname}-d}i, "icon d css class missing"
|
73
|
+
assert css =~ %r{.icon-#{fontname}-a_R3ally-eXotic-f1Le-Name}i, "exotic name css class missing"
|
74
|
+
assert css =~ %r{.icon-#{fontname}-google}i, "google icon css class missing"
|
73
75
|
end
|
74
76
|
|
75
77
|
def test_glyph_mixin
|
@@ -82,13 +84,13 @@ class FontImporterTest < Test::Unit::TestCase
|
|
82
84
|
@include fontcustom-font-face($myfont-glyphs);
|
83
85
|
|
84
86
|
.custom-class-name {
|
85
|
-
@include myfont-glyph(
|
87
|
+
@include myfont-glyph('a_R3ally-eXotic f1Le Name');
|
86
88
|
}
|
87
89
|
SCSS
|
88
90
|
|
89
91
|
assert css =~ %r{.#{fontname}-font, .custom-class-name}, "extending base class missing"
|
90
92
|
assert css =~ %r{@font-face}, "font-face definition missing"
|
91
|
-
assert css =~ %r{.custom-class-name:before}, "
|
93
|
+
assert css =~ %r{.custom-class-name:before}, "custom class missing missing"
|
92
94
|
end
|
93
95
|
|
94
96
|
end
|
data/test/unit/glyph_map_test.rb
CHANGED
@@ -16,10 +16,4 @@ class GlyphMapTest < Test::Unit::TestCase
|
|
16
16
|
assert_equal 0, @glyph_map.index_for_glyph('C')
|
17
17
|
end
|
18
18
|
|
19
|
-
def test_glyph_name_normalization
|
20
|
-
glyphs = @glyph_map.instance_variable_get(:@glyphs)
|
21
|
-
assert ! glyphs.include?('google+')
|
22
|
-
assert glyphs.include?('google')
|
23
|
-
end
|
24
|
-
|
25
19
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: compass-fontcustom
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- glaszig
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-11-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: compass
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 1.
|
33
|
+
version: 1.2.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ~>
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 1.
|
40
|
+
version: 1.2.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|