]> git.ipfire.org Git - thirdparty/foundation/foundation-emails.git/commitdiff
99 gulpfile probz.
authorJeanie Chung <jeanie.chung@gmail.com>
Thu, 19 Feb 2015 23:24:32 +0000 (15:24 -0800)
committerJeanie Chung <jeanie.chung@gmail.com>
Thu, 19 Feb 2015 23:24:32 +0000 (15:24 -0800)
gulpfile.js
package.json
src/pages/goodbye.handlebars

index bd3879c8547c9619b22661bf7380d4fe2fe0c15d..aac315c5916f9303088d2963a4291f8c4f62ed00 100644 (file)
 var gulp       = require('gulp'),
     watch      = require('gulp-watch'),
     sass       = require('gulp-ruby-sass'),
-    html2txt   = require('gulp-html2txt'),
     inlineCss  = require('gulp-inline-css'),
     rename     = require('gulp-rename'),
     connect    = require('gulp-connect'),
     minifyHTML = require('gulp-minify-html'),
-    concat     = require('gulp-concat'),
     extractMQ  = require('media-query-extractor'),
     inject     = require('gulp-inject'),
     inkyGulp   = require('gulp-inky'),
     handlebars = require('gulp-compile-handlebars'),
     omglob     = require('glob'),
+    gSync      = require('gulp-sync')(gulp),
     runOrder   = require('run-sequence'),
     rimraf     = require('rimraf');
 
@@ -133,34 +132,15 @@ gulp.task('copy-html', function() {
 
 // Inject handlebars partials
 gulp.task('compile-html', function() {
-  
-  omglob(dirs.src + '/pages/*.handlebars', 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('.'));
-
-      var templateData = {},
-          options = {
-            batch : ['./src/partials']
-          };
-   
-      gulp.src(files[i])
-        .pipe(handlebars(templateData, options))
-        .pipe(rename(fileName + '.html'))
-        .pipe(gulp.dest(dirs.temp));
-    }
-  })
-
   // silly gulp asynch. The previous task sometimes happens too fast, so it can't find
   // the new temporary partials
-  setTimeout(function() {
+  var injectHtml = 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')
+        gulp.src(dirs.src + '/layouts/default.html')
           .pipe(inject(gulp.src(files[i]), {
             starttag: '<!-- inject:page:{{ext}} -->',
             transform: function (filePath, file) {
@@ -174,15 +154,37 @@ gulp.task('compile-html', function() {
         .pipe(gulp.dest(dirs.temp)) 
       }
     })
-  }, 100);
+  };
+
+  omglob(dirs.src + '/pages/*.handlebars', 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('.'));
+
+      var templateData = {},
+          options = {
+            batch : ['./src/partials']
+          };
+   
+      gulp.src(files[i])
+        .pipe(handlebars(templateData, options))
+        .pipe(rename(fileName + '.html'))
+        .pipe(gulp.dest(dirs.temp));
+    }
+
+  injectHtml();
+  })
+
 });
 
+
 // 6. Syntax Transformer
 // - - - - - - - - - - - - - - -
 
 // get the HTML from the body and run it through Inky parser
 
-gulp.task('query', ['compile-html'], function() {
+gulp.task('query', function() {
   gulp.src(dirs.temp + '/*.html')
     .pipe(inkyGulp())
     .pipe(gulp.dest(dirs.dist))
@@ -193,9 +195,9 @@ gulp.task('query', ['compile-html'], function() {
 // - - - - - - - - - - - - - - -
 
 // Eventual Litmus/Mailgun integration
-gulp.task('test', function () {
+// gulp.task('test', function () {
 
-});
+// });
 
 // 8. GO FORTH AND BUILD
 // - - - - - - - - - - - - - - -
@@ -222,15 +224,8 @@ 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 + '/*/*.*'], function(event) {
-    runOrder('query', 'minify-html');
-  });
+  gulp.watch([dirs.src + '/*/*.*'], ['compile-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());
-  })
 
 });
 
index 23c220ca0bd4dc8f74a729b1bc4ceec70bbde944..723b4ad3ec1d79544163a080bd3d51fec369e520 100644 (file)
@@ -7,15 +7,14 @@
     "glob": "^4.4.0",
     "gulp": "^3.8.10",
     "gulp-compile-handlebars": "^0.4.4",
-    "gulp-concat": "^2.4.3",
     "gulp-connect": "^2.2.0",
     "gulp-foreach": "^0.1.0",
-    "gulp-html2txt": "^1.1.0",
     "gulp-inky": "*",
     "gulp-inline-css": "^1.0.1",
     "gulp-minify-html": "^0.1.8",
     "gulp-rename": "^1.2.0",
     "gulp-ruby-sass": "^0.7.1",
+    "gulp-sync": "^0.1.4",
     "gulp-watch": "^4.1.1",
     "rimraf": "^2.2.8",
     "run-sequence": "^1.0.2"
index 469a932683f854e72481f80d5c38b1b7542ced41..b406dd2256959e05b66d9ac3a024edb2c317ac28 100644 (file)
@@ -1,5 +1,5 @@
 <row>
   <columns large='12'>
-  <h6>Wsfaf</h6>
+  <h6>What's up</h6>
   </columns>
 </row>
\ No newline at end of file