mirror of
https://github.com/kremalicious/blog.git
synced 2024-11-26 11:49:04 +01:00
commit
10680cbd7a
22
Gruntfile.js
22
Gruntfile.js
@ -11,7 +11,8 @@ module.exports = function(grunt){
|
|||||||
css: 'assets/css',
|
css: 'assets/css',
|
||||||
js: 'assets/js',
|
js: 'assets/js',
|
||||||
img: 'assets/img',
|
img: 'assets/img',
|
||||||
fonts: 'assets/fonts'
|
fonts: 'assets/fonts',
|
||||||
|
cdnurl: 'https://d2jlreog722xe2.cloudfront.net/assets/'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -50,7 +51,8 @@ module.exports = function(grunt){
|
|||||||
},
|
},
|
||||||
production: {
|
production: {
|
||||||
options: {
|
options: {
|
||||||
lsi: true
|
lsi: true,
|
||||||
|
raw: 'enable_cdnurl: true\n'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
development: {
|
development: {
|
||||||
@ -205,6 +207,19 @@ module.exports = function(grunt){
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// CDN some assets
|
||||||
|
cdn: {
|
||||||
|
options: {
|
||||||
|
cdn: '<%= config.cdnurl %>',
|
||||||
|
flatten: true
|
||||||
|
},
|
||||||
|
dist: {
|
||||||
|
src: [
|
||||||
|
'<%= config.build %>/assets/**/*.css' // CDN all assets called from css files
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
// rsync stuff around
|
// rsync stuff around
|
||||||
rsync: {
|
rsync: {
|
||||||
options: {
|
options: {
|
||||||
@ -287,7 +302,8 @@ module.exports = function(grunt){
|
|||||||
'imagemin:touchicons',
|
'imagemin:touchicons',
|
||||||
'rsync:copy_build',
|
'rsync:copy_build',
|
||||||
'rev',
|
'rev',
|
||||||
'usemin'
|
'usemin',
|
||||||
|
'cdn'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// Optimze media
|
// Optimze media
|
||||||
|
@ -15,6 +15,8 @@ description: 'Blog of designer & developer Matthias Kretschmann'
|
|||||||
url: https://kremalicious.com
|
url: https://kremalicious.com
|
||||||
author: Matthias Kretschmann
|
author: Matthias Kretschmann
|
||||||
email: m@kretschmann.io
|
email: m@kretschmann.io
|
||||||
|
cdnurl: https://d2jlreog722xe2.cloudfront.net
|
||||||
|
enable_cdnurl: false
|
||||||
|
|
||||||
|
|
||||||
# Urls
|
# Urls
|
||||||
|
@ -65,7 +65,6 @@
|
|||||||
<!-- Picturefill -->
|
<!-- Picturefill -->
|
||||||
<script src="/assets/js/picturefill.min.js" defer></script>
|
<script src="/assets/js/picturefill.min.js" defer></script>
|
||||||
|
|
||||||
|
|
||||||
<!-- Canonical URL -->
|
<!-- Canonical URL -->
|
||||||
<link rel="canonical" href="{{ site.url}}{{ page.url | replace:'index.html','' }}">
|
<link rel="canonical" href="{{ site.url}}{{ page.url | replace:'index.html','' }}">
|
||||||
|
|
||||||
|
@ -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["baseurl"])
|
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, baseurl)
|
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,12 @@ module Jekyll
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Return path relative to the site root for html
|
# Return path relative to the site root for html
|
||||||
Pathname.new(File.join(baseurl, image_dest, image_dir, gen_name)).cleanpath
|
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
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -10,6 +10,7 @@ pre,
|
|||||||
samp
|
samp
|
||||||
font-family: $font-family-monospace
|
font-family: $font-family-monospace
|
||||||
font-size: $font-size-small
|
font-size: $font-size-small
|
||||||
|
hyphens: none
|
||||||
|
|
||||||
code,
|
code,
|
||||||
kbd
|
kbd
|
||||||
|
@ -23,7 +23,8 @@
|
|||||||
"grunt-jekyll": ">=0.4.0",
|
"grunt-jekyll": ">=0.4.0",
|
||||||
"grunt-rsync": ">=0.2.1",
|
"grunt-rsync": ">=0.2.1",
|
||||||
"grunt-rev": ">=0.1.0",
|
"grunt-rev": ">=0.1.0",
|
||||||
"grunt-usemin": ">=2.0.2"
|
"grunt-usemin": ">=2.0.2",
|
||||||
|
"grunt-cdn": ">=0.5.6"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=0.10.29"
|
"node": ">=0.10.29"
|
||||||
|
Loading…
Reference in New Issue
Block a user