icomoon2sass 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/icomoon2sass/cli.rb +5 -3
- data/lib/icomoon2sass/sass.rb +12 -12
- data/lib/icomoon2sass/templates/list.sass.erb +1 -1
- data/lib/icomoon2sass/templates/map.sass.erb +1 -1
- data/lib/icomoon2sass/templates/oocss_list.sass.erb +4 -0
- data/lib/icomoon2sass/templates/oocss_map.sass.erb +3 -0
- data/lib/icomoon2sass/version.rb +1 -1
- data/lib/run.rb +21 -0
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0a950e6bc77ff1331d2e3ef292382b433b5690aa
|
4
|
+
data.tar.gz: 8d76c54bf86d370e9d297d829a587945178d1b68
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: baefe6bb865165be45e235c8624c80189ef52007616301e2484763f8c5a8c7f9479c7b045f53c3917074974f3e98eb4ce25e002fd02d5d6e6c0d8f54771929ba
|
7
|
+
data.tar.gz: 1265deb0b8c629f359884920a6aac9598ac642e486d72e207c9cdd21e61884bfefcb6f4023673b53427fd523df64cc5fd51717b1d70c181fc14ef956e65090ea
|
data/lib/icomoon2sass/cli.rb
CHANGED
@@ -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
|
-
|
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
|
|
data/lib/icomoon2sass/sass.rb
CHANGED
@@ -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
|
-
|
11
|
-
|
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(
|
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
|
|
data/lib/icomoon2sass/version.rb
CHANGED
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.
|
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
|