1
0
mirror of https://github.com/kremalicious/blog.git synced 2024-11-22 09:56:51 +01:00

try to work around slow regeneration with picture tag

This commit is contained in:
Matthias Kretschmann 2013-11-23 18:14:41 +01:00
parent 404b6a28cd
commit cef2589cfa
6 changed files with 48 additions and 50 deletions

View File

@ -15,11 +15,11 @@ module.exports = function(grunt){
// banner
grunt.log.writeln("");
grunt.log.writeln(" <<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>");
grunt.log.writeln(" <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
grunt.log.writeln("");
grunt.log.writeln(" Just what do you think you're doing, Matthias? ");
grunt.log.writeln(" | (o) | Just what do you think you're doing, Matthias? ");
grunt.log.writeln("");
grunt.log.writeln(" <<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>");
grunt.log.writeln(" <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
grunt.log.writeln("");
// Grunt config
@ -34,13 +34,16 @@ module.exports = function(grunt){
// Jekyll
jekyll: {
options: {
},
production : {
options: {
lsi: true
}
// options: {
// lsi: true
// }
},
serve: {
src: '<%= config.src %>/'
}
},
@ -159,20 +162,30 @@ module.exports = function(grunt){
},
},
// Deployment
// rsync stuff around
rsync: {
options: {
args: ['--verbose'],
recursive: true,
syncDest: true,
compareMode: 'checksum',
ssh: true
recursive: true
},
production: {
// copy media folder
copy_media: {
options: {
src: '<%= config.src %>/_media/',
dest: '<%= config.site %>/media/',
args: ["--exclude='gen'"],
}
},
// deployment
deploy: {
options: {
syncDest: true,
src: '<%= config.site %>/',
dest: 'domains/kremalicious.com/html/',
host: 'kremalicious'
host: 'kremalicious',
ssh: true,
args: ['--verbose'],
compareMode: 'checksum'
}
}
}
@ -193,6 +206,7 @@ module.exports = function(grunt){
// Dev server
grunt.registerTask('server', [
'rsync:copy_media',
'jekyll:serve',
'less',
'cmq',
@ -202,6 +216,16 @@ module.exports = function(grunt){
'watch'
]);
// Dev server - assets only
grunt.registerTask('server-assets', [
'less',
'cmq',
'cssmin',
'uglify',
'connect',
'watch'
]);
// Imagemin only task
grunt.registerTask('imagemin', [
'imagemin'
@ -210,6 +234,7 @@ module.exports = function(grunt){
// Production build
grunt.registerTask('build', [
'clean',
'rsync:copy_media',
'jekyll:production',
'imagemin',
'less',
@ -220,7 +245,7 @@ module.exports = function(grunt){
// Deploy
grunt.registerTask('deploy', [
'rsync'
'rsync:deploy'
]);
};

View File

@ -3,7 +3,7 @@ description: 'Blog of designer & developer Matthias Kretschmann'
url: http://kremalicious.com
author: Matthias Kretschmann
permalink: /:title
permalink: /post/:title
relative_permalinks: true
paginate: 10
paginate_path: "/page/:num"
@ -13,16 +13,16 @@ pygments: true
source: ./_src
destination: ./_site
exclude: ['design', 'node_modules', '_src/assets/less']
exclude: ['design', 'node_modules', 'less']
keep_files: ['media']
picture:
source: "_media"
output: "media_gen"
output: "media/gen"
markup: "picturefill"
presets:
default:
ppi: [1, 1.5, 2]
ppi: [1, 1.5]
attr:
itemprop: "image"
source_medium:

View File

@ -7,16 +7,7 @@ layout: base
<div class="photoPost">
<figure class="hmedia">
<span data-picture data-alt="{{ page.title }}">
<span data-src="/media/320/{{ page.image }}"></span>
<span data-src="/media/640/{{ page.image }}" data-media="(min-device-pixel-ratio: 1.5)"></span>
<span data-src="/media/640/{{ page.image }}" data-media="(min-width: 500px)"></span>
<span data-src="/media/1280/{{ page.image }}" data-media="(min-width: 640px) and (min-device-pixel-ratio: 2.0)"></span>
<noscript>
<img src="/media/{{ page.image }}">
</noscript>
</span>
{% picture {{ page.image }} %}
<figcaption class="entry-title fn">{{ page.title }}</figcaption>
exif

View File

@ -9,16 +9,7 @@ layout: base
<section class="entry-content">
{% if page.image %}
<span class="teaser" data-picture data-alt="">
<span data-src="/media/320/{{ post.image }}"></span>
<span data-src="/media/640/{{ post.image }}" data-media="(min-device-pixel-ratio: 1.5)"></span>
<span data-src="/media/640/{{ post.image }}" data-media="(min-width: 500px)"></span>
<span data-src="/media/1280/{{ post.image }}" data-media="(min-width: 640px) and (min-device-pixel-ratio: 2.0)"></span>
<noscript>
<img src="/media/{{ post.image }}">
</noscript>
</span>
{% picture {{ page.image }} class="teaser" %}
{% endif %}
{{ content }}

View File

@ -1,9 +0,0 @@
# http://rentzsch.tumblr.com/post/58936832594/speed-up-jekyll-using-one-weird-trick
module Jekyll
class RsyncMediaFolder < Generator
def generate(site)
system('mkdir -p _site'); # We may be called before _site exists.
system('rsync --archive --delete _src/_media/ _site/media/');
end
end
end