From fd9f1e64de1ede5df4d7dbad7cb9504ff410fb5e Mon Sep 17 00:00:00 2001 From: Rob Wierzbowski Date: Fri, 5 Jul 2013 18:05:33 -0400 Subject: [PATCH] Add image_destination to config['keep_files'] in #render (@parkr) Resolves #3 and #4 --- picture_tag.rb | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/picture_tag.rb b/picture_tag.rb index 372aa87b..9a788d1e 100644 --- a/picture_tag.rb +++ b/picture_tag.rb @@ -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])) @@ -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)