rimraf('./build/html', cb);
});
+// Clean the JS directory
+gulp.task('clean:js', function(cb) {
+ rimraf('./build/js', cb);
+})
+
// 4. STYLESHEETS
// - - - - - - - - - - - - - - -
.pipe(gulp.dest(dirs.build + '/js/'));
});
-// Concat all js files
-gulp.task('js', ['jquery'], function() {
- gulp.src(dirs.js)
- .pipe(concat('main.js'))
+gulp.task('inky-prime', function() {
+ return gulp.src(dirs.js)
+ .pipe(concat('inky-prime.js'))
.pipe(gulp.dest(dirs.build + '/js/'))
- .pipe(connect.reload());
+ .pipe(connect.reload());
+})
+
+gulp.task('js', ['clean:js', 'jquery'], function() {
+ gulp.start('inky-prime');
});
// 7. GO FORTH AND BUILD
// - - - - - - - - - - - - - - -
// Wipes build folder, then compiles SASS, then minifies and copies HTML
-gulp.task('build', ['clean', 'sass'], function() {
+gulp.task('build', ['clean', 'sass', 'js'], function() {
gulp.start('minify-html');
});
<head>
<link rel="stylesheet" type="text/css" href="css/ink.css">
<script type="text/javascript" src="js/jquery.js"></script>
- <script type="text/javascript" src="js/main.js"></script>
+ <script type="text/javascript" src="js/inky-prime.js"></script>
</head>
<body>
<p>This is an email.</p>
<div class="inky loaded"></div>
</div>
+ <container>
+ <row>
+ <column class="four">
+ four col
+ <div class="bloop">
+ bloop
+ </div>
+ </column>
+ <column class="eight">eight col</column>
+ </row>
+ </container>
+ <container>
+ <row>
+ <column class="two">
+ two col
+ </div>
+ </column>
+ <column class="eight">eight col</column>
+ <column class="two">two col</column>
+ </row>
+ </container>
- <table class="row">
- <tr>
- <td class="wrapper">
-
- </td>
- </tr>
- </table>
-
- <row></row>
+ <container>empty container</container>
+ <row>empty row</row>
</body>
</html>
\ No newline at end of file
--- /dev/null
+// Columns
+
+// TODO: Make private function
+
+var createCol = function(obj) {
+ var output = '';
+
+ $.each(obj, function(v,k) {
+ var temp = ''
+ var contents = $(this).html();
+ var colClass = 'columns ' + $(this).attr('class');
+
+ if (v !== obj.length - 1) {
+ temp = '<td class="wrapper">'
+ +'<table class="' + colClass + '">'
+ +'<tr><td>'
+ + contents +'</tr></td></table></td>';
+ } else {
+ temp = '<td class="wrapper last">'
+ +'<table class="' + colClass + '">'
+ +'<tr><td>'
+ + contents +'</tr></td></table></td>';
+ }
+
+ output += temp;
+ });
+
+ return output;
+};
--- /dev/null
+// Rows
+
+$(document).on('ready', function() {
+ $('row').each(function() {
+ var contents = $(this).html();
+ var html = $.parseHTML( contents );
+
+ // find a better way to detect empty row
+ // or will we ever have an empty row?
+ if (html[0].nodeName !== '#text') {
+ contents = createCol(html);
+ }
+
+ $(this).empty().html('<tr>' + contents + '</tr>');
+ $(this).replaceWith(function() {
+ return $('<table/>', {
+ class: 'row',
+ html: this.innerHTML
+ });
+ });
+
+ });
+});
+++ /dev/null
-row
\ No newline at end of file
--- /dev/null
+// Table Main Body
+
+$(document).on('ready', function() {
+
+ $('container').each(function() {
+ var contents = $(this).html();
+ $(this).empty().html('<tbody><tr><td>' + contents + '</td></tr></tbody>');
+
+ $(this).replaceWith(function() {
+ return $('<table/>', {
+ class: 'container',
+ html: this.innerHTML
+ });
+ });
+
+ });
+});