From cef2589cfa5cc0238c724837056fed18df78c4f1 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Sat, 23 Nov 2013 18:14:41 +0100 Subject: [PATCH] try to work around slow regeneration with picture tag --- .gitignore | 2 +- Gruntfile.js | 57 +++++++++++++++++++++-------- _config.yml | 8 ++-- _src/_layouts/image.html | 11 +----- _src/_layouts/post.html | 11 +----- _src/_plugins/rsync_media_folder.rb | 9 ----- 6 files changed, 48 insertions(+), 50 deletions(-) delete mode 100644 _src/_plugins/rsync_media_folder.rb diff --git a/.gitignore b/.gitignore index 18ce53a0..5a87346b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ node_modules -_site +_site \ No newline at end of file diff --git a/Gruntfile.js b/Gruntfile.js index 0c592c79..8a023b32 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -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', @@ -201,6 +215,16 @@ module.exports = function(grunt){ 'connect', 'watch' ]); + + // Dev server - assets only + grunt.registerTask('server-assets', [ + 'less', + 'cmq', + 'cssmin', + 'uglify', + 'connect', + 'watch' + ]); // Imagemin only task grunt.registerTask('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' ]); }; \ No newline at end of file diff --git a/_config.yml b/_config.yml index 7e86491e..e3c57877 100644 --- a/_config.yml +++ b/_config.yml @@ -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: diff --git a/_src/_layouts/image.html b/_src/_layouts/image.html index 1f715281..68978259 100644 --- a/_src/_layouts/image.html +++ b/_src/_layouts/image.html @@ -7,16 +7,7 @@ layout: base
- - - - - - - - + {% picture {{ page.image }} %}
{{ page.title }}
exif diff --git a/_src/_layouts/post.html b/_src/_layouts/post.html index dde677dd..ed853e9d 100644 --- a/_src/_layouts/post.html +++ b/_src/_layouts/post.html @@ -9,16 +9,7 @@ layout: base
{% if page.image %} - - - - - - - - + {% picture {{ page.image }} class="teaser" %} {% endif %} {{ content }} diff --git a/_src/_plugins/rsync_media_folder.rb b/_src/_plugins/rsync_media_folder.rb deleted file mode 100644 index ea79d410..00000000 --- a/_src/_plugins/rsync_media_folder.rb +++ /dev/null @@ -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 \ No newline at end of file