Skip to content

Commit 42efc91

Browse files
committed
Adding default_spacing option
1 parent d127155 commit 42efc91

File tree

4 files changed

+6
-3
lines changed

4 files changed

+6
-3
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ Configuration of `sprite` is done via `config/sprite.yml`. It allows you to set
7777
- `public_path:` defines the root folder where static assets live (defaults to `public/`)
7878
- `sprites_class:` defines the class name that gets added to all sprite stylesheet rules (defaults to `sprites`)
7979
- `default_format:` defines the default file image format of the generated files. (defaults to `png`)
80+
- `default_spacing:` defines the default pixel spacing between sprites (defaults to 0)
8081
- `class_separator:` used to generated the class name by separating the image name and sprite name (defaults to `-`)
8182

8283
* `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:
@@ -101,6 +102,7 @@ All image and style paths should be set relative to the public folder (which is
101102
sprites_class: 'sprites'
102103
class_separator: '-'
103104
default_format: png
105+
default_spacing: 50
104106

105107
# defines what sprite collections get created
106108
images:

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.1.5
1+
0.1.6

lib/sprite/builder.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def write_image(image)
5959

6060
name = image['name']
6161
format = image['format'] || config["default_format"]
62-
spaced_by = image['spaced_by'] || 0
62+
spaced_by = image['spaced_by'] || config["default_spacing"] || 0
6363

6464
combiner = ImageCombiner.new
6565

@@ -108,6 +108,7 @@ def set_config_defaults
108108
@config['default_format'] ||= 'png'
109109
@config['class_separator'] ||= '-'
110110
@config["sprites_class"] ||= 'sprites'
111+
@config["default_spacing"] ||= 0
111112
end
112113

113114
# if no image configs are detected, set some intelligent defaults

spec/sprite/config_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
end
99

1010
it "should load the settings keys from file" do
11-
@sprite.config.keys.size.should == 8
11+
@sprite.config.keys.size.should == 9
1212
end
1313

1414
it "should load the image keys from file" do

0 commit comments

Comments
 (0)