icomoon2sass 1.0.1 → 1.0.2

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: ccf7cb89b759466cb6a7a4ae9b4386968d2c9db0
4
- data.tar.gz: 246ed42b8813b0d9fbfba05113e46edca983f8bf
3
+ metadata.gz: 0a950e6bc77ff1331d2e3ef292382b433b5690aa
4
+ data.tar.gz: 8d76c54bf86d370e9d297d829a587945178d1b68
5
5
  SHA512:
6
- metadata.gz: 5f83beb0b2f444608d6a7a84bb7e372bfb752fdfd766796f24487ef3787c09049a7515de2c6157d7e31962c6e0fbc4123707bdfa739511d43af69490b33097ad
7
- data.tar.gz: 4b55075a4ee1d49692c75ecf7c9229d93ae15ad055b0934eca154099f92584810e250ea5c92d9f902206042fe9295a94a2825f4e5591e486f55711f6142f72bf
6
+ metadata.gz: baefe6bb865165be45e235c8624c80189ef52007616301e2484763f8c5a8c7f9479c7b045f53c3917074974f3e98eb4ce25e002fd02d5d6e6c0d8f54771929ba
7
+ data.tar.gz: 1265deb0b8c629f359884920a6aac9598ac642e486d72e207c9cdd21e61884bfefcb6f4023673b53427fd523df64cc5fd51717b1d70c181fc14ef956e65090ea
@@ -11,6 +11,7 @@ class Icomoon2Sass::CLI < Thor::Group
11
11
  class_option :'sass-path', type: :string, default: './', desc: 'Destination path for Sass files'
12
12
  class_option :scss, type: :boolean, default: false, desc: 'Use the SCSS syntax'
13
13
  class_option :compatible, aliases: '-c', type: :boolean, default: false, desc: 'Generate code compatible with Sass 3.2'
14
+ class_option :oocss, type: :boolean, default: false, desc: 'Generate OOCSS-style classes'
14
15
 
15
16
  def start
16
17
 
@@ -40,14 +41,15 @@ class Icomoon2Sass::CLI < Thor::Group
40
41
 
41
42
  sass = Icomoon2Sass::Sass.new font, syntax, compatible
42
43
 
43
-
44
44
 
45
-
46
45
  # Save the Sass file
47
46
  create_file "#{options['sass-path']}/_icons.#{sass.syntax}", sass.code
48
47
 
49
- files.font_files.each do |filename, content|
48
+ if options['oocss']
49
+ create_file "#{options['sass-path']}/_oocss_icons.#{sass.syntax}", sass.oocss
50
+ end
50
51
 
52
+ files.font_files.each do |filename, content|
51
53
  create_file "#{options['font-path']}/#{filename.sub('fonts/', '')}", content
52
54
  end
53
55
 
@@ -5,25 +5,25 @@ class Icomoon2Sass::Sass
5
5
  attr_reader :code, :syntax
6
6
 
7
7
  def initialize(font, syntax = 'sass', compatible = false)
8
+ @font = font
8
9
  @syntax = syntax
10
+
11
+ @format = compatible ? 'list' : 'map'
12
+
13
+ @code = sass_convert 'sass', syntax, template(@format)
14
+ end
9
15
 
10
- if compatible
11
- @code = sass_convert 'sass', syntax, template('list', font)
12
-
13
- else
14
- @code = sass_convert 'sass', syntax, template('map', font)
15
- end
16
+ def oocss
17
+ sass_convert 'sass', syntax, template("oocss_#{@format}")
16
18
  end
17
19
 
18
20
  private
19
21
 
20
- def template(format, font)
21
- icons = font.icons
22
- font_family = font.font_family
23
-
24
- tmpl = File.read("#{File.dirname(__FILE__)}/templates/#{format}.sass.erb")
22
+ def template(tmpl)
23
+ icons = @font.icons
24
+ font_family = @font.font_family
25
25
 
26
- renderer = ERB.new(tmpl)
26
+ renderer = ERB.new File.read("#{File.dirname(__FILE__)}/templates/#{tmpl}.sass.erb")
27
27
  renderer.result(binding)
28
28
  end
29
29
 
@@ -16,7 +16,7 @@
16
16
  -moz-osx-font-smoothing: grayscale
17
17
 
18
18
  <% icons.each do |icon, content| %>
19
- <%= "%#{icon}-icon" %>:before
19
+ <%= "%#{icon}-icon" %>
20
20
  @extend %icon-pseudo-content
21
21
 
22
22
  content: <%= "$#{icon}-icon" %>
@@ -40,7 +40,7 @@ $icons: ( <%=
40
40
 
41
41
 
42
42
  @each $placeholder, $content in $icons
43
- %#{$placeholder}-icon:before
43
+ %#{$placeholder}-icon
44
44
  @extend %icon-pseudo-content
45
45
 
46
46
  @each $value in $content
@@ -0,0 +1,4 @@
1
+ <% icons.each do |icon, content| %>
2
+ <%= ".#{icon}-icon" %>:before
3
+ @extend %<%= "#{icon}-icon" %>
4
+ <% end %>
@@ -0,0 +1,3 @@
1
+ @each $placeholder, $content in $icons
2
+ .#{$placeholder}-icon:before
3
+ @extend %#{$placeholder}-icon
@@ -1,4 +1,4 @@
1
1
  module Icomoon2Sass
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.2"
3
3
  end
4
4
 
data/lib/run.rb CHANGED
@@ -47,6 +47,27 @@ OUTPUT
47
47
 
48
48
  %gear-icon
49
49
  content: $gear-icon
50
+
51
+ OOCSS
52
+
53
+ By default, icomoon2sass only generates Sass placeholder selectors. If you need
54
+ literal CSS classes pass the '--oocss' flag, and icomoon2sass will generate a
55
+ second Sass file, '_oocss_icons.sass', containing CSS classes for each icon.
56
+
57
+ @each $placeholder, $content in $icons
58
+ .\#{$placeholder}-icon:before
59
+ @extend %\#{$placeholder}-icon
60
+
61
+ Or, for Sass 3.2, something like this:
62
+
63
+ .github-icon:before
64
+ @extend %github-icon
65
+
66
+ .twitter-icon:before
67
+ @extend %twitter-icon
68
+
69
+ .gear-icon:before
70
+ @extend %gear-icon
50
71
  EOT
51
72
 
52
73
  command = ARGV[0]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: icomoon2sass
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jed Foster
@@ -69,6 +69,8 @@ files:
69
69
  - lib/icomoon2sass/sass.rb
70
70
  - lib/icomoon2sass/templates/list.sass.erb
71
71
  - lib/icomoon2sass/templates/map.sass.erb
72
+ - lib/icomoon2sass/templates/oocss_list.sass.erb
73
+ - lib/icomoon2sass/templates/oocss_map.sass.erb
72
74
  - lib/icomoon2sass/version.rb
73
75
  - lib/icomoon2sass/zip.rb
74
76
  - lib/run.rb