rails-sprite 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -0
- data/lib/rails_sprite/library/rmagick.rb +1 -1
- data/lib/rails_sprite/stylesheet_generator.rb +18 -37
- data/lib/rails_sprite/version.rb +1 -1
- 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: 81291115be7ec430a5000cdde3d17c1f2b6ffb6f
|
4
|
+
data.tar.gz: 0eeec1854a98518edfa05f08a493f13ee6f64964
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ea498c75f7dc6315e83df0c25a3ff940274044e49c6a211e6ef9a1c765736c48f77e9eedb065a3b3b7c8967f20573ff28398defecac771b133ce742a1460c608
|
7
|
+
data.tar.gz: 189134668d4ea09035b2171b584e368f8fbac4947b70d4d5fb4cb74aab45afcb87adec0087ec19864cfb8d954613e94f43bbea043cfe7eb86aebb3da41b623ed
|
data/README.md
CHANGED
@@ -30,15 +30,16 @@ module RailsSprite
|
|
30
30
|
result[:image_scope_name] = image_scope_name
|
31
31
|
result[:css_class_shared] = css_class_shared
|
32
32
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
33
|
+
css_filt_content = case css_extend
|
34
|
+
when '.css.scss.erb', '.scss.erb'
|
35
|
+
composite_css_scss_erb(result)
|
36
|
+
else
|
37
|
+
end
|
37
38
|
|
38
39
|
system "mkdir -p #{::File.dirname(stylesheet_to)}"
|
39
40
|
|
40
41
|
::File.open(stylesheet_to, 'w') do |file|
|
41
|
-
file.write(
|
42
|
+
file.write( css_filt_content )
|
42
43
|
end
|
43
44
|
|
44
45
|
result
|
@@ -47,48 +48,28 @@ module RailsSprite
|
|
47
48
|
def self.composite_css_scss_erb result
|
48
49
|
styles = []
|
49
50
|
|
51
|
+
styles << <<-END_CSS
|
52
|
+
.#{result[:css_class_shared]} {
|
53
|
+
background-image: url(<%= image_path("#{result[:image_scope_name]}") %>);
|
54
|
+
background-repeat: no-repeat;
|
55
|
+
}
|
56
|
+
END_CSS
|
57
|
+
|
50
58
|
result[:styles].each do |style|
|
51
59
|
styles << <<-END_CSS
|
52
60
|
.#{style[:class]} {
|
53
|
-
background:
|
61
|
+
background-position: #{style[:x]} -#{style[:y]};
|
54
62
|
}
|
55
63
|
END_CSS
|
56
|
-
end
|
57
|
-
|
58
64
|
|
59
|
-
# styles << <<-END_CSS
|
60
|
-
# .#{result[:css_class_shared]} {
|
61
|
-
# background: url(<%= image_path("#{result[:image_scope_name]}") %>) no-repeat;
|
62
|
-
# }
|
63
|
-
# END_CSS
|
64
|
-
|
65
|
-
# result[:styles].each do |style|
|
66
|
-
# styles << <<-END_CSS
|
67
|
-
#.#{style[:class]} {
|
68
|
-
# background-position: #{style[:x]} -#{style[:y]};
|
69
|
-
#}
|
70
|
-
# END_CSS
|
71
|
-
# end
|
72
65
|
|
66
|
+
# .#{style[:class]} {
|
67
|
+
# background: url(<%= image_path("#{result[:image_scope_name]}") %>) #{style[:x]} -#{style[:y]} no-repeat;
|
68
|
+
# }
|
69
|
+
end
|
73
70
|
|
74
71
|
styles.join("\n")
|
75
72
|
end
|
76
73
|
|
77
|
-
# def self.generate(style_name, selector, url, images)
|
78
|
-
# styles = []
|
79
|
-
# images.each do |image|
|
80
|
-
# attr = [
|
81
|
-
# "width: #{image[:cssw]}px",
|
82
|
-
# "height: #{image[:cssh]}px",
|
83
|
-
# "background: #{url} #{-image[:cssx]}px #{-image[:cssy]}px no-repeat"
|
84
|
-
# ]
|
85
|
-
# image[:selector] = selector # make selector available for (optional) custom rule generators
|
86
|
-
# image[:style] = send("#{style_name}_style", attr) # make pure style available for (optional) custom rule generators (see usage of yield inside Runner#style)
|
87
|
-
# styles << send(style_name, selector, image[:name], attr)
|
88
|
-
# end
|
89
|
-
# styles << ""
|
90
|
-
# styles.join("\n")
|
91
|
-
# end
|
92
|
-
|
93
74
|
end
|
94
75
|
end
|
data/lib/rails_sprite/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails-sprite
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- happy
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-05-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|