sprite 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -79,7 +79,8 @@ Configuration of `sprite` is done via `config/sprite.yml`. It allows you to set
79
79
  - `default_format:` defines the default file image format of the generated files. (defaults to `png`)
80
80
  - `default_spacing:` defines the default pixel spacing between sprites (defaults to 0)
81
81
  - `class_separator:` used to generated the class name by separating the image name and sprite name (defaults to `-`)
82
-
82
+ - `add_datestamps`: whether or not to add datestamps to the generated background image urls. this will allow proper cache versioning (defaults to `true`)
83
+
83
84
  * `images:` section provides an array of configurations which define which image files are built, and where they get their sprites from. each image setup provides the following config options:
84
85
  - `name:` name of image (required)
85
86
  - `sources:` defines a list of source image filenames to build the target image from (required). They are parsed by <code>Dir.glob</code>
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.6
1
+ 0.1.7
@@ -30,6 +30,9 @@ module Sprite
30
30
  @images = images || []
31
31
  set_image_defaults
32
32
  expand_image_paths
33
+
34
+ # initialize datestamp
35
+ @datestamp_query = "?#{Time.now.to_i}" if @config["add_datestamps"]
33
36
 
34
37
  # initialize sprite files
35
38
  @sprite_files = {}
@@ -86,7 +89,7 @@ module Sprite
86
89
 
87
90
  # write sprite image file to disk
88
91
  dest_image.write(path)
89
- @sprite_files["#{name}.#{format}"] = results
92
+ @sprite_files["#{name}.#{format}#{@datestamp_query}"] = results
90
93
  end
91
94
 
92
95
  def write_styles
@@ -111,6 +114,10 @@ module Sprite
111
114
  @config['class_separator'] ||= '-'
112
115
  @config["sprites_class"] ||= 'sprites'
113
116
  @config["default_spacing"] ||= 0
117
+
118
+ unless @config.has_key?("add_datestamps")
119
+ @config["add_datestamps"] = true
120
+ end
114
121
  end
115
122
 
116
123
  # if no image configs are detected, set some intelligent defaults
data/sprite.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{sprite}
8
- s.version = "0.1.6"
8
+ s.version = "0.1.7"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Jacques Crocker"]
12
- s.date = %q{2009-11-19}
12
+ s.date = %q{2009-12-22}
13
13
  s.default_executable = %q{sprite}
14
14
  s.description = %q{sprite is a rails/merb plugin that generates sprites for css, sass}
15
15
  s.email = %q{merbjedi@gmail.com}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sprite
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jacques Crocker
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-11-19 00:00:00 -08:00
12
+ date: 2009-12-22 00:00:00 -08:00
13
13
  default_executable: sprite
14
14
  dependencies: []
15
15