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

View File

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

View File

@ -7,16 +7,7 @@ layout: base
<div class="photoPost"> <div class="photoPost">
<figure class="hmedia"> <figure class="hmedia">
<span data-picture data-alt="{{ page.title }}"> {% picture {{ page.image }} %}
<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>
<figcaption class="entry-title fn">{{ page.title }}</figcaption> <figcaption class="entry-title fn">{{ page.title }}</figcaption>
exif exif

View File

@ -9,16 +9,7 @@ layout: base
<section class="entry-content"> <section class="entry-content">
{% if page.image %} {% if page.image %}
<span class="teaser" data-picture data-alt=""> {% picture {{ page.image }} class="teaser" %}
<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>
{% endif %} {% endif %}
{{ content }} {{ 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