amikula-sprite 0.1.12 → 0.1.13
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/sprite/builder.rb +14 -0
- data/lib/sprite/sass_extensions.rb +3 -19
- metadata +20 -27
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.13
|
data/lib/sprite/builder.rb
CHANGED
@@ -62,6 +62,20 @@ module Sprite
|
|
62
62
|
"#{config['css_image_path']}#{sprite_file}"
|
63
63
|
end
|
64
64
|
|
65
|
+
def sprite_data(group, image)
|
66
|
+
unless @__sprite_data
|
67
|
+
# read sprite data from yml
|
68
|
+
@__sprite_data = File.open(style_output_path) { |yf| YAML::load( yf ) }
|
69
|
+
end
|
70
|
+
|
71
|
+
group_data = @__sprite_data[group.value]
|
72
|
+
if group_data
|
73
|
+
return group_data[image.value]
|
74
|
+
else
|
75
|
+
nil
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
65
79
|
protected
|
66
80
|
def write_image(image_info)
|
67
81
|
results = []
|
@@ -19,7 +19,7 @@ module Sprite
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def sprite_background(group, image)
|
22
|
-
sprite = sprite_data(group, image)
|
22
|
+
sprite = sprite_builder.sprite_data(group, image)
|
23
23
|
if sprite
|
24
24
|
sprite_path = sprite_path(group)
|
25
25
|
::Sass::Script::String.new "url('#{sprite_path}') no-repeat #{sprite[:x]}px #{sprite[:y]}px"
|
@@ -81,7 +81,7 @@ module Sprite
|
|
81
81
|
end
|
82
82
|
|
83
83
|
def sprite_attr(attr, group, image)
|
84
|
-
sprite = sprite_data(group, image)
|
84
|
+
sprite = sprite_builder.sprite_data(group, image)
|
85
85
|
if sprite
|
86
86
|
"#{sprite[attr]}px"
|
87
87
|
else
|
@@ -90,23 +90,7 @@ module Sprite
|
|
90
90
|
end
|
91
91
|
|
92
92
|
def sprite_builder
|
93
|
-
|
94
|
-
end
|
95
|
-
|
96
|
-
def sprite_data(group, image)
|
97
|
-
unless @__sprite_data
|
98
|
-
sprite_data_path = sprite_builder.style_output_path
|
99
|
-
|
100
|
-
# read sprite data from yml
|
101
|
-
@__sprite_data = File.open(sprite_data_path) { |yf| YAML::load( yf ) }
|
102
|
-
end
|
103
|
-
|
104
|
-
group_data = @__sprite_data[group.value]
|
105
|
-
if group_data
|
106
|
-
return group_data[image.value]
|
107
|
-
else
|
108
|
-
nil
|
109
|
-
end
|
93
|
+
@@__sprite_builder ||= Builder.from_config
|
110
94
|
end
|
111
95
|
end
|
112
96
|
end
|
metadata
CHANGED
@@ -1,28 +1,25 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: amikula-sprite
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.13
|
4
5
|
prerelease:
|
5
|
-
version: 0.1.12
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- Jacques Crocker
|
9
9
|
- Alf Mikula
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
|
14
|
-
date: 2011-11-04 00:00:00 Z
|
13
|
+
date: 2012-08-29 00:00:00.000000000 Z
|
15
14
|
dependencies: []
|
16
|
-
|
17
15
|
description: sprite is a rails/merb plugin that generates sprites for css, sass
|
18
16
|
email: amikula@gmail.com
|
19
|
-
executables:
|
17
|
+
executables:
|
20
18
|
- sprite
|
21
19
|
extensions: []
|
22
|
-
|
23
|
-
extra_rdoc_files:
|
20
|
+
extra_rdoc_files:
|
24
21
|
- README.md
|
25
|
-
files:
|
22
|
+
files:
|
26
23
|
- MIT-LICENSE
|
27
24
|
- README.md
|
28
25
|
- Rakefile
|
@@ -48,30 +45,26 @@ files:
|
|
48
45
|
- tasks/sprite_tasks.rake
|
49
46
|
homepage: http://github.com/amikula/sprite
|
50
47
|
licenses: []
|
51
|
-
|
52
48
|
post_install_message:
|
53
49
|
rdoc_options: []
|
54
|
-
|
55
|
-
require_paths:
|
50
|
+
require_paths:
|
56
51
|
- lib
|
57
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
52
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
58
53
|
none: false
|
59
|
-
requirements:
|
60
|
-
- -
|
61
|
-
- !ruby/object:Gem::Version
|
62
|
-
version:
|
63
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
54
|
+
requirements:
|
55
|
+
- - ! '>='
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: '0'
|
58
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
64
59
|
none: false
|
65
|
-
requirements:
|
66
|
-
- -
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version:
|
60
|
+
requirements:
|
61
|
+
- - ! '>='
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '0'
|
69
64
|
requirements: []
|
70
|
-
|
71
65
|
rubyforge_project:
|
72
|
-
rubygems_version: 1.8.
|
66
|
+
rubygems_version: 1.8.24
|
73
67
|
signing_key:
|
74
68
|
specification_version: 3
|
75
69
|
summary: generate your css sprites automagically
|
76
70
|
test_files: []
|
77
|
-
|