graphite-sass 0.2.3 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/graphite.rb +37 -46
- data/stylesheets/graphite.scss +2 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9c32922d22406cb400ede2f9b82606ab548c9fc0
|
4
|
+
data.tar.gz: 884bcaf3375be4d9c77a1cc8bdf6d2d5f921f039
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e56670cf705fd9ba6125313713fab6792202cf4a2482545007ed0904d8442b60b52cd0375660497bd2451973a1958f97e27810118f60e7a65f53d0fd15e95360
|
7
|
+
data.tar.gz: e378dad0da0b09cc1659b95c5bc238f4acd764ddea426f1d9302d4be21384cc33fa9f2c0f60885f9da66ff0a394934f4b74f662d821349f5314dd92ac14e9407
|
data/lib/graphite.rb
CHANGED
@@ -5,8 +5,8 @@ extension_path = File.expand_path(File.join(File.dirname(__FILE__), ".."))
|
|
5
5
|
Compass::Frameworks.register('graphite', :path => extension_path)
|
6
6
|
|
7
7
|
module Graphite
|
8
|
-
VERSION = "0.
|
9
|
-
DATE = "2014-
|
8
|
+
VERSION = "0.3.0"
|
9
|
+
DATE = "2014-08-11"
|
10
10
|
end
|
11
11
|
|
12
12
|
# Graphite : import fonts from font_dir into map
|
@@ -87,59 +87,50 @@ module Sass::Script::Functions
|
|
87
87
|
# Keep hash of all fonts found
|
88
88
|
fonts = {}
|
89
89
|
# Valid font extensions
|
90
|
-
valid_extensions = ["eot", "otf", "woff", "ttf", "svg"]
|
91
|
-
# Check if directory exists
|
92
|
-
dir_name = File.dirname(dir)
|
90
|
+
valid_extensions = ["eot", "otf", "woff2", "woff", "ttf", "svg"]
|
93
91
|
|
94
|
-
if File.exists?(
|
92
|
+
if File.exists?(dir)
|
95
93
|
# Print debug
|
96
94
|
puts "Fonts directory found: #{dir}" if debug
|
97
95
|
# Change dir to font_dir
|
98
96
|
Dir.chdir(dir) do
|
99
97
|
# Search each dir
|
100
98
|
Dir.glob("**/") do | d |
|
101
|
-
# Check if
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
# Merge weights and styles
|
123
|
-
set_font_style(variations, w)
|
124
|
-
# Save extensions that don't already exist
|
125
|
-
extensions << ext if extensions.include?(ext) === false
|
126
|
-
end
|
99
|
+
# Check if dir has fonts
|
100
|
+
Dir.chdir(d) do
|
101
|
+
path = d
|
102
|
+
# Clean up font name
|
103
|
+
family = d.delete("/")
|
104
|
+
# Print debug
|
105
|
+
puts "Font family found: #{family}" if debug
|
106
|
+
# Get matched extensions
|
107
|
+
extensions = []
|
108
|
+
# Get matched weights and styles
|
109
|
+
variations = {}
|
110
|
+
# Check dir for matching extensions
|
111
|
+
valid_extensions.each do | ext |
|
112
|
+
Dir.glob("*.#{ext}") do | filename |
|
113
|
+
puts "Font found: #{filename}" if debug
|
114
|
+
# Check if filename has weights
|
115
|
+
w = font_has_weights?(filename.to_s)
|
116
|
+
# Merge weights and styles
|
117
|
+
set_font_style(variations, w)
|
118
|
+
# Save extensions that don't already exist
|
119
|
+
extensions << ext if extensions.include?(ext) === false
|
127
120
|
end
|
128
|
-
# Build out font hash
|
129
|
-
font = {
|
130
|
-
"#{family}" => {
|
131
|
-
"path" => path,
|
132
|
-
"extensions" => extensions,
|
133
|
-
"weights" => variations
|
134
|
-
}
|
135
|
-
}
|
136
|
-
# Merge into fonts hash
|
137
|
-
fonts = fonts.merge(font)
|
138
|
-
# Set Sass variable for font family
|
139
|
-
set_sass_var(family)
|
140
121
|
end
|
141
|
-
|
142
|
-
|
122
|
+
# Build out font hash
|
123
|
+
font = {
|
124
|
+
"#{family}" => {
|
125
|
+
"path" => path,
|
126
|
+
"extensions" => extensions,
|
127
|
+
"weights" => variations
|
128
|
+
}
|
129
|
+
}
|
130
|
+
# Merge into fonts hash
|
131
|
+
fonts = fonts.merge(font)
|
132
|
+
# Set Sass variable for font family
|
133
|
+
set_sass_var(family)
|
143
134
|
end
|
144
135
|
end
|
145
136
|
end
|
data/stylesheets/graphite.scss
CHANGED
@@ -135,6 +135,7 @@ $graphite_chdir: ".." !global;
|
|
135
135
|
|
136
136
|
// Define value for each type
|
137
137
|
$eot: if(index($extensions, "eot"), url("#{$path + $filename}.eot?#iefix") format("embedded-opentype"), null);
|
138
|
+
$woff2: if(index($extensions, "woff2"), url("#{$path + $filename}.woff2") format("woff2"), null);
|
138
139
|
$woff: if(index($extensions, "woff"), url("#{$path + $filename}.woff") format("woff"), null);
|
139
140
|
$otf: if(index($extensions, "otf"), url("#{$path + $filename}.otf") format("opentype"), null);
|
140
141
|
$ttf: if(index($extensions, "ttf"), url("#{$path + $filename}.ttf") format("truetype"), null);
|
@@ -142,6 +143,7 @@ $graphite_chdir: ".." !global;
|
|
142
143
|
|
143
144
|
// Append to types list if not null
|
144
145
|
$types: if($eot != null, append($types, #{$eot}, "comma"), $types);
|
146
|
+
$types: if($woff2 != null, append($types, #{$woff2}, "comma"), $types);
|
145
147
|
$types: if($woff != null, append($types, #{$woff}, "comma"), $types);
|
146
148
|
$types: if($otf != null, append($types, #{$otf}, "comma"), $types);
|
147
149
|
$types: if($ttf != null, append($types, #{$ttf}, "comma"), $types);
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: graphite-sass
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ezekiel Gabrielse
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-08-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sass
|