css_sprite 1.0.3 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.textile +9 -22
- data/VERSION +1 -1
- data/css_sprite.gemspec +2 -2
- data/lib/css_sprite/sprite.rb +9 -6
- data/tasks/css_sprite_tasks.rake +1 -2
- metadata +2 -2
data/README.textile
CHANGED
@@ -47,7 +47,7 @@ forum_icon_vertical.gif: # destination image file
|
|
47
47
|
- sticky_topic.gif
|
48
48
|
orient: vertical # composite gravity, vertical or horizontal
|
49
49
|
span: 5 # span of space between two images
|
50
|
-
prefix: "
|
50
|
+
prefix: "v-" # css class prefix
|
51
51
|
</code></pre>
|
52
52
|
|
53
53
|
first line defines the destination image filename.
|
@@ -75,26 +75,13 @@ rake css_sprite:build
|
|
75
75
|
|
76
76
|
the result css is generated at <code>public/stylesheets/css_sprite.css</code>
|
77
77
|
<pre><code>
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
}
|
83
|
-
.
|
84
|
-
|
85
|
-
width: 20px;
|
86
|
-
height: 19px;
|
87
|
-
}
|
88
|
-
.unread_topic {
|
89
|
-
background: url('/images/forum_icon_vertical.gif') no-repeat 0px 48px;
|
90
|
-
width: 19px;
|
91
|
-
height: 18px;
|
92
|
-
}
|
93
|
-
.sticky_topic {
|
94
|
-
background: url('/images/forum_icon_vertical.gif') no-repeat 0px 71px;
|
95
|
-
width: 19px;
|
96
|
-
height: 18px;
|
97
|
-
}
|
78
|
+
/* do not touch - generated through 'rake css_sprite:build' */
|
79
|
+
.v-forum_icon_vertical { background: url('/images/forum_icon_vertical.gif?1265358559') no-repeat; }
|
80
|
+
.v-good_topic { background-position: 0px 0px; width: 20px; height: 19px; }
|
81
|
+
.v-mid_topic { background-position: 0px -29px; width: 20px; height: 19px; }
|
82
|
+
.v-sticky_topic { background-position: 0px -58px; width: 19px; height: 18px; }
|
83
|
+
.v-unread_topic { background-position: 0px -86px; width: 19px; height: 18px; }
|
84
|
+
.v-plectix_logo { background-position: 0px -114px; width: 125px; height: 47px; }
|
98
85
|
</code></pre>
|
99
86
|
|
100
87
|
**************************************************************************
|
@@ -102,7 +89,7 @@ the result css is generated at <code>public/stylesheets/css_sprite.css</code>
|
|
102
89
|
h2. Contributor
|
103
90
|
|
104
91
|
josedelcorral - fix the style of generated css
|
105
|
-
Santino - fix transparent images
|
92
|
+
Santino - fix transparent images and make the generated css file more graceful
|
106
93
|
|
107
94
|
**************************************************************************
|
108
95
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0
|
1
|
+
1.1.0
|
data/css_sprite.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{css_sprite}
|
8
|
-
s.version = "1.0
|
8
|
+
s.version = "1.1.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Richard Huang"]
|
12
|
-
s.date = %q{2010-02-
|
12
|
+
s.date = %q{2010-02-05}
|
13
13
|
s.description = %q{css_sprite is a rails plugin/gem to generate css sprite image automatically.}
|
14
14
|
s.email = %q{flyerhzm@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
data/lib/css_sprite/sprite.rb
CHANGED
@@ -23,7 +23,7 @@ class Sprite
|
|
23
23
|
sources = configs['sources'].collect {|source| Dir.glob(IMAGE_PATH + source)}.flatten
|
24
24
|
span = configs['span'] || 0
|
25
25
|
dest_image = get_image(sources.shift)
|
26
|
-
results << image_properties(dest_image).merge(:x => 0, :y => 0)
|
26
|
+
results << image_properties(dest_image).merge(:x => 0, :y => 0, :prefix => configs['prefix'])
|
27
27
|
sources.each do |source|
|
28
28
|
source_image = get_image(source)
|
29
29
|
if configs['orient'] == 'horizontal'
|
@@ -44,13 +44,16 @@ class Sprite
|
|
44
44
|
|
45
45
|
def output_css
|
46
46
|
File.open(PUBLIC_PATH + 'css_sprite.css', 'w') do |f|
|
47
|
+
f.puts "/* do not touch - generated through 'rake css_sprite:build' */"
|
47
48
|
@output.each do |dest, results|
|
49
|
+
basename = File.basename(dest, File.extname(dest))
|
50
|
+
f.puts ".#{results.first[:prefix]}#{basename} { background: url('/images/#{dest}?#{Time.now.to_i}') no-repeat; }"
|
48
51
|
results.each do |result|
|
49
|
-
f.
|
50
|
-
f.
|
51
|
-
f.
|
52
|
-
f.
|
53
|
-
f.
|
52
|
+
f.print ".#{result[:prefix]}#{result[:name]} \{"
|
53
|
+
f.print " background-position: #{-result[:x]}px #{-result[:y]}px;"
|
54
|
+
f.print " width: #{result[:width]}px;"
|
55
|
+
f.print " height: #{result[:height]}px;"
|
56
|
+
f.print " \}\n"
|
54
57
|
end
|
55
58
|
end
|
56
59
|
end
|
data/tasks/css_sprite_tasks.rake
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: css_sprite
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard Huang
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-02-
|
12
|
+
date: 2010-02-05 00:00:00 +08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|