mirror of
https://github.com/kremalicious/blog.git
synced 2024-11-22 09:56:51 +01:00
more semantic config key
This commit is contained in:
parent
17fb1a4612
commit
2d03799c90
@ -51,7 +51,7 @@ module.exports = function(grunt){
|
||||
production: {
|
||||
options: {
|
||||
lsi: true,
|
||||
raw: 'production: true\n'
|
||||
raw: 'enable_cdnurl: true\n'
|
||||
}
|
||||
},
|
||||
development: {
|
||||
|
@ -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
|
||||
# --------------------
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user