From 2d03799c90a8e1859590a6ceffe96e001540b3c4 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Sat, 6 Sep 2014 14:37:39 +0200 Subject: [PATCH] more semantic config key --- Gruntfile.js | 2 +- _config.yml | 4 ++-- _src/_plugins/picture_tag.rb | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index dd207346..a3f69c2f 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -51,7 +51,7 @@ module.exports = function(grunt){ production: { options: { lsi: true, - raw: 'production: true\n' + raw: 'enable_cdnurl: true\n' } }, development: { diff --git a/_config.yml b/_config.yml index 6257aa5a..dfdc0ab2 100644 --- a/_config.yml +++ b/_config.yml @@ -16,8 +16,8 @@ url: https://kremalicious.com author: Matthias Kretschmann email: m@kretschmann.io cdnurl: https://d2jlreog722xe2.cloudfront.net -production: false -#cdnurl: https://cdn.kremalicious.com +enable_cdnurl: false + # Urls # -------------------- diff --git a/_src/_plugins/picture_tag.rb b/_src/_plugins/picture_tag.rb index 0f8cb657..ef1772f8 100755 --- a/_src/_plugins/picture_tag.rb +++ b/_src/_plugins/picture_tag.rb @@ -142,7 +142,7 @@ module Jekyll # Generate resized images instance.each { |key, source| - instance[key][:generated_src] = generate_image(source, site.source, site.dest, settings['source'], settings['output'], site.config['cdnurl'], site.config["baseurl"], site.config['production']) + instance[key][:generated_src] = generate_image(source, site.source, site.dest, settings['source'], settings['output'], site.config['cdnurl'], site.config["baseurl"], site.config['enable_cdnurl']) } # Construct and return tag @@ -169,7 +169,7 @@ module Jekyll picture_tag end - def generate_image(instance, site_source, site_dest, image_source, image_dest, cdnurl, baseurl, production) + def generate_image(instance, site_source, site_dest, image_source, image_dest, cdnurl, baseurl, enable_cdnurl) image = MiniMagick::Image.open(File.join(site_source, image_source, instance[:src])) digest = Digest::MD5.hexdigest(image.to_blob).slice!(0..5) @@ -230,7 +230,7 @@ module Jekyll end # Return path relative to the site root for html - if production == 'true' + if enable_cdnurl == 'true' Pathname.new(File.join(cdnurl, baseurl, image_dest, image_dir, gen_name)).cleanpath else Pathname.new(File.join(baseurl, image_dest, image_dir, gen_name)).cleanpath