From: Jeanie Chung Date: Thu, 19 Feb 2015 22:23:10 +0000 (-0800) Subject: New and shiny sidebar email using templates. X-Git-Tag: v2.0.0-rc.1~123 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e40513cb49b2f6a69d1ab21c0422bb43f9645abf;p=thirdparty%2Ffoundation%2Ffoundation-emails.git New and shiny sidebar email using templates. --- diff --git a/gulpfile.js b/gulpfile.js index 26614a42..bd3879c8 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -16,6 +16,7 @@ // - - - - - - - - - - - - - - - var gulp = require('gulp'), + watch = require('gulp-watch'), sass = require('gulp-ruby-sass'), html2txt = require('gulp-html2txt'), inlineCss = require('gulp-inline-css'), @@ -130,31 +131,8 @@ gulp.task('copy-html', function() { .pipe(connect.reload()) }); -// Inject html partials into default page -gulp.task('inject-html', function() { - omglob(dirs.temp + '/*.html', function(er, files) { - for (var i = 0; i < files.length; i++) { - var filePath = files[i].replace(/\\/g, '/'); - var fileName = filePath.substring(filePath.lastIndexOf('/')+1, filePath.lastIndexOf('.')); - - gulp.src(dirs.src + '/layouts/default.html') - .pipe(inject(gulp.src(files[i]), { - starttag: '', - transform: function (filePath, file) { - // return file contents as string - return file.contents.toString('utf8') - } - })) - .pipe(rename({ - basename: fileName - })) - .pipe(gulp.dest(dirs.dist)); - } - }) -}); - // Inject handlebars partials -gulp.task('inject-handlebars', function() { +gulp.task('compile-html', function() { omglob(dirs.src + '/pages/*.handlebars', function(er, files) { @@ -173,24 +151,39 @@ gulp.task('inject-handlebars', function() { .pipe(gulp.dest(dirs.temp)); } }) -}); -gulp.task('compile', function() { - runOrder('clean:temp', 'inject-handlebars', function() { - // better way to do this? - setTimeout(function() { - gulp.start('inject-html') - }, 50); - }); -}) + // silly gulp asynch. The previous task sometimes happens too fast, so it can't find + // the new temporary partials + setTimeout(function() { + omglob(dirs.temp + '/*.html', function(er, files) { + for (var i = 0; i < files.length; i++) { + var filePath = files[i].replace(/\\/g, '/'); + var fileName = filePath.substring(filePath.lastIndexOf('/')+1, filePath.lastIndexOf('.')); + + gulp.src(dirs.src + '/layouts/default.html') + .pipe(inject(gulp.src(files[i]), { + starttag: '', + transform: function (filePath, file) { + // return file contents as string + return file.contents.toString('utf8') + } + })) + .pipe(rename({ + basename: fileName + })) + .pipe(gulp.dest(dirs.temp)) + } + }) + }, 100); +}); // 6. Syntax Transformer // - - - - - - - - - - - - - - - // get the HTML from the body and run it through Inky parser -gulp.task('query', function() { - gulp.src(dirs.dist + '/*.html') +gulp.task('query', ['compile-html'], function() { + gulp.src(dirs.temp + '/*.html') .pipe(inkyGulp()) .pipe(gulp.dest(dirs.dist)) .pipe(connect.reload()); @@ -207,9 +200,10 @@ gulp.task('test', function () { // 8. GO FORTH AND BUILD // - - - - - - - - - - - - - - - + // Wipes build folder, then compiles SASS, then minifies and copies HTML -gulp.task('build', ['clean:dist', 'sass', 'query'], function() { - gulp.start('minify-html'); +gulp.task('build', function() { + runOrder('clean:dist', 'sass','query','minify-html'); }); // 9. Serve/Watch Tasks @@ -228,8 +222,16 @@ gulp.task('serve', function() { // Watch all HTML files and SCSS files for changes // Live reloads on change gulp.task('watch', ['serve'], function() { - gulp.watch([dirs.src], ['compile','query','minify-html']); + gulp.watch([dirs.src + '/*/*.*'], function(event) { + runOrder('query', 'minify-html'); + }); gulp.watch([dirs.styles], ['sass']); + // watch([dirs.dist + '/*.*']).pipe(connect.reload()); + gulp.watch([dirs.dist + '/*.*'], function(event) { + gulp.src(event.path) + .pipe(connect.reload()); + }) + }); diff --git a/package.json b/package.json index 443c41a0..23c220ca 100644 --- a/package.json +++ b/package.json @@ -13,12 +13,11 @@ "gulp-html2txt": "^1.1.0", "gulp-inky": "*", "gulp-inline-css": "^1.0.1", - "gulp-jasmine": "^2.0.0", "gulp-minify-html": "^0.1.8", "gulp-rename": "^1.2.0", "gulp-ruby-sass": "^0.7.1", + "gulp-watch": "^4.1.1", "rimraf": "^2.2.8", - "run-sequence": "^1.0.2", - "vinyl-map": "^1.0.1" + "run-sequence": "^1.0.2" } } diff --git a/src/pages/goodbye.handlebars b/src/pages/goodbye.handlebars index e0f26a9a..469a9326 100644 --- a/src/pages/goodbye.handlebars +++ b/src/pages/goodbye.handlebars @@ -1,3 +1,5 @@ -
Goodbasdfasdfye
+ +
Wsfaf
+
\ No newline at end of file diff --git a/src/pages/hello.handlebars b/src/pages/hello.handlebars index bc5e2f76..78aba098 100644 --- a/src/pages/hello.handlebars +++ b/src/pages/hello.handlebars @@ -1,4 +1,69 @@ - -

Hello!

-
-{{> header }} \ No newline at end of file +{{> header }} + + + +

Welcome, Daneel Olivan

+

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et.

+ +
+
+ + + +

Phasellus dictum sapien a neque luctus cursus. Pellentesque sem dolor, fringilla et pharetra vitae. Click it! »

+
+
+
+ + +

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et. Lorem ipsum dolor sit amet.

+ +

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et. Lorem ipsum dolor sit amet.

+ +
+ + +
Header Thing
+

Sub-head or something

+ + Just a Plain Link » + Just a Plain Link » + Just a Plain Link » +
+ Just a Plain Link » +
+ Just a Plain Link » +
+ Just a Plain Link » +
+ Just a Plain Link » +
+
+
+
+ + + + + +
Connect With Us:
+ +
+ +
+ +
+
Contact Info:
+

Phone: 408.341.0600

+

Email: hseldon@trantor.com

+
+
+
+
+ {{> footer }} diff --git a/src/partials/footer.handlebars b/src/partials/footer.handlebars new file mode 100644 index 00000000..985208da --- /dev/null +++ b/src/partials/footer.handlebars @@ -0,0 +1,7 @@ + + +
+

Terms | Privacy | Unsubscribe

+
+
+
\ No newline at end of file diff --git a/src/partials/header.handlebars b/src/partials/header.handlebars index 036387df..2ec4b26e 100644 --- a/src/partials/header.handlebars +++ b/src/partials/header.handlebars @@ -1,5 +1,10 @@ - - - header maybe? + + + + + + + SIDEBAR HERO + - \ No newline at end of file + \ No newline at end of file