Skip to content

Commit

Permalink
Add image_destination to config['keep_files'] in #render (@parkr)
Browse files Browse the repository at this point in the history
Resolves #3 and #4
  • Loading branch information
Rob Wierzbowski committed Jul 5, 2013
1 parent 410e36e commit fd9f1e6
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions picture_tag.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ def render(context)
image_source = settings['source_path'] || '.'
image_dest = settings['output_path'] || File.join(image_source, 'generated')

# Prevent Jekyll from erasing our copied files
site.config['keep_files'] << image_dest unless site.config['keep_files'].include?(image_dest)

# Deep copy preset to sources for single instance manipulation
sources = Marshal.load(Marshal.dump(settings['presets'][@preset]))

Expand Down Expand Up @@ -220,12 +223,6 @@ def generate_image(source, site_source, site_dest, image_source, image_dest)
gen_jekyll_path
end
end

# Patch to prevent Jekyll from erasing our copied files (there's probably a less ugly way to do this)
class Configuration < Hash
picture = Jekyll.configuration({})['picture']
DEFAULTS['keep_files'] = DEFAULTS['keep_files'].push(picture['output_path'] || 'generated') unless picture.nil?
end
end

Liquid::Template.register_tag('picture', Jekyll::Picture)

0 comments on commit fd9f1e6

Please sign in to comment.