graphite-sass 0.2.3 → 0.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 59635904abff0a3f7018ce95570aefc07868fc4b
4
- data.tar.gz: d70399f77f29fc5ac7d0156173db5f934507efde
3
+ metadata.gz: 9c32922d22406cb400ede2f9b82606ab548c9fc0
4
+ data.tar.gz: 884bcaf3375be4d9c77a1cc8bdf6d2d5f921f039
5
5
  SHA512:
6
- metadata.gz: 4e726737519ab90c74faa744af1b18d18e98e6363350b925fb1456d284dab3c3c0788b1da3a36f98d5ad106b0223230d0d3455b6f586e8da5286709d94fe0994
7
- data.tar.gz: 9d29cb54ef89bb7f13141eb68484970ee1c55b9218e8c86e2becc49a2e70fe34ee26c8e32876d89200d192a70472d1a3c3b658b34f37b0f9fe52f60551491a23
6
+ metadata.gz: e56670cf705fd9ba6125313713fab6792202cf4a2482545007ed0904d8442b60b52cd0375660497bd2451973a1958f97e27810118f60e7a65f53d0fd15e95360
7
+ data.tar.gz: e378dad0da0b09cc1659b95c5bc238f4acd764ddea426f1d9302d4be21384cc33fa9f2c0f60885f9da66ff0a394934f4b74f662d821349f5314dd92ac14e9407
@@ -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.2.3"
9
- DATE = "2014-07-30"
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?(dir_name)
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 directory exists
102
- dir_name = File.dirname(d)
103
-
104
- if File.exists?(dir_name)
105
- # Check if dir has fonts
106
- Dir.chdir(d) do
107
- path = d
108
- # Clean up font name
109
- family = d.delete("/")
110
- # Print debug
111
- puts "Font family found: #{family}" if debug
112
- # Get matched extensions
113
- extensions = []
114
- # Get matched weights and styles
115
- variations = {}
116
- # Check dir for matching extensions
117
- valid_extensions.each do | ext |
118
- Dir.glob("*.#{ext}") do | filename |
119
- puts "Font found: #{filename}" if debug
120
- # Check if filename has weights
121
- w = font_has_weights?(filename.to_s)
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
- else
142
- puts "Directory was not found: #{dir}. Aborting mission."
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
@@ -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.2.3
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-07-30 00:00:00.000000000 Z
11
+ date: 2014-08-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sass