Skip to content

Commit e0ba326

Browse files
committed
Fixing style writers to use the correct relative path
1 parent 7a40b77 commit e0ba326

File tree

4 files changed

+8
-7
lines changed

4 files changed

+8
-7
lines changed

lib/sprite/builder.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,12 @@ def write_image(image)
9090
def write_styles
9191
style = Styles.get(config["style"]).new(self)
9292

93-
# set up path
94-
path = style_output_path(style.extension)
93+
# use the absolute style output path to make sure we have the directory set up
94+
path = style_output_path(style.extension, false)
9595
FileUtils.mkdir_p(File.dirname(path))
9696

97-
style.write(path, @sprite_files)
97+
# send the style the relative path
98+
style.write(style_output_path(style.extension, true), @sprite_files)
9899
end
99100

100101
# sets all the default values on the config

lib/sprite/styles/css_generator.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def write(path, sprite_files)
1111
sprites_class = @builder.config['sprites_class'] ? ".#{@builder.config['sprites_class']}" : ""
1212

1313
# write styles to disk
14-
File.open(path, 'w') do |f|
14+
File.open(File.join(Sprite.root, path), 'w') do |f|
1515
# write stylesheet file to disk
1616
sprite_files.each do |sprite_file, sprites|
1717
sprites.each do |sprite|

lib/sprite/styles/sass_generator.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def initialize(builder)
1010
def write(path, sprite_files)
1111
@level = 0
1212

13-
File.open(path, 'w') do |f|
13+
File.open(File.join(Sprite.root, path), 'w') do |f|
1414
if @builder.config['sprites_class']
1515
f.puts ".#{@builder.config['sprites_class']}"
1616
@level += 1

lib/sprite/styles/sass_mixin_generator.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def write(path, sprite_files)
1212
config_location = write_config(path, sprite_files)
1313

1414
# write the sass mixins to disk
15-
File.open(path, 'w') do |f|
15+
File.open(File.join(Sprite.root, path), 'w') do |f|
1616
f.puts "!sprite_data = '#{config_location}'"
1717
f.puts ""
1818
f.puts "= sprite(!group_name, !image_name)"
@@ -38,7 +38,7 @@ def write_config(path, sprite_files)
3838

3939
# write the config yml to disk
4040
config_path = path.gsub(".sass", ".yml")
41-
File.open(config_path, 'w') do |f|
41+
File.open(File.join(Sprite.root, config_path), 'w') do |f|
4242
YAML.dump(result, f)
4343
end
4444

0 commit comments

Comments
 (0)