mirror of
https://github.com/kremalicious/blog.git
synced 2024-11-22 18:00:06 +01:00
more semantic config key
This commit is contained in:
parent
17fb1a4612
commit
2d03799c90
@ -51,7 +51,7 @@ module.exports = function(grunt){
|
|||||||
production: {
|
production: {
|
||||||
options: {
|
options: {
|
||||||
lsi: true,
|
lsi: true,
|
||||||
raw: 'production: true\n'
|
raw: 'enable_cdnurl: true\n'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
development: {
|
development: {
|
||||||
|
@ -16,8 +16,8 @@ url: https://kremalicious.com
|
|||||||
author: Matthias Kretschmann
|
author: Matthias Kretschmann
|
||||||
email: m@kretschmann.io
|
email: m@kretschmann.io
|
||||||
cdnurl: https://d2jlreog722xe2.cloudfront.net
|
cdnurl: https://d2jlreog722xe2.cloudfront.net
|
||||||
production: false
|
enable_cdnurl: false
|
||||||
#cdnurl: https://cdn.kremalicious.com
|
|
||||||
|
|
||||||
# Urls
|
# Urls
|
||||||
# --------------------
|
# --------------------
|
||||||
|
@ -142,7 +142,7 @@ module Jekyll
|
|||||||
|
|
||||||
# Generate resized images
|
# Generate resized images
|
||||||
instance.each { |key, source|
|
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
|
# Construct and return tag
|
||||||
@ -169,7 +169,7 @@ module Jekyll
|
|||||||
picture_tag
|
picture_tag
|
||||||
end
|
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]))
|
image = MiniMagick::Image.open(File.join(site_source, image_source, instance[:src]))
|
||||||
digest = Digest::MD5.hexdigest(image.to_blob).slice!(0..5)
|
digest = Digest::MD5.hexdigest(image.to_blob).slice!(0..5)
|
||||||
|
|
||||||
@ -230,7 +230,7 @@ module Jekyll
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Return path relative to the site root for html
|
# 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
|
Pathname.new(File.join(cdnurl, baseurl, image_dest, image_dir, gen_name)).cleanpath
|
||||||
else
|
else
|
||||||
Pathname.new(File.join(baseurl, image_dest, image_dir, gen_name)).cleanpath
|
Pathname.new(File.join(baseurl, image_dest, image_dir, gen_name)).cleanpath
|
||||||
|
Loading…
Reference in New Issue
Block a user