From: Jeanie Chung Date: Wed, 18 Feb 2015 21:44:08 +0000 (-0800) Subject: Changes to column calculations if someone did not put in size attributes. Gulp now... X-Git-Tag: v2.0.0-rc.1~130 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cf5170097dced496fc52051def4c04cfbac91d86;p=thirdparty%2Ffoundation%2Ffoundation-emails.git Changes to column calculations if someone did not put in size attributes. Gulp now has 'inject-mq' task to put media queries in the header. --- diff --git a/gulpfile.js b/gulpfile.js index 38f8877b..fedb9b71 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -23,6 +23,8 @@ var gulp = require('gulp'), connect = require('gulp-connect'), minifyHTML = require('gulp-minify-html'), concat = require('gulp-concat'), + extractMQ = require('media-query-extractor'), + inject = require('gulp-inject'), zfEmail = require('gulp-zurb-foundation-email'), rimraf = require('rimraf'), jasmine = require('gulp-jasmine'); @@ -68,6 +70,27 @@ gulp.task('inline', function() { .pipe(gulp.dest(dirs.build)) }); +// extract media queries into new CSS file called inkMQ.css +// any remaining styles will go into ink-noMQ.css +gulp.task('extract-mq', function () { + extractMQ( dirs.build + '/css/ink.css', dirs.build + '/css/ink-noMQ.css', ['only screen and (max-width: 600px)|./build/css/inkMQ.css']); +}); + +// inject media queries into the head of the inlined email +gulp.task('inject-mq', ['extract-mq'], function() { + gulp.src(dirs.build + '/index-inline.html') + .pipe(inject(gulp.src(dirs.build + '/css/inkMQ.css'), { + starttag: '', + transform: function (filePath, file) { + // return file contents as string + return "" + } + })) + .pipe(gulp.dest('./build')); +}) + + + // 5. HTML // - - - - - - - - - - - - - - - @@ -163,6 +186,8 @@ gulp.task('watch', ['serve'], function() { }); -gulp.task('deploy', ['minify-html', 'inline']); +gulp.task('deploy', ['minify-html', 'inline'], function() { + gulp.start('inject-mq'); +}); // Default task gulp.task('default', ['serve', 'watch']); diff --git a/html/index.html b/html/index.html index 08251f8f..6bae2840 100644 --- a/html/index.html +++ b/html/index.html @@ -2,6 +2,8 @@ + +