forked from leemunroe/grunt-email-workflow
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds preview interface and express server + grunt options. Ignores co…
…mpiled preview/css
- Loading branch information
Showing
11 changed files
with
519 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,4 @@ node_modules | |
*.css.map | ||
secrets.json | ||
dist/* | ||
preview/css |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<!DOCTYPE html> | ||
<html lang="en" class="welcome-view"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>BLANK</title> | ||
<link rel="stylesheet" href="/css/preview.css"> | ||
</head> | ||
<body> | ||
<div class="wrapper"> | ||
<div class="wrapper--inner"> | ||
<div class="animation"> | ||
<span class="animation--icon"><span></span></span> | ||
<span class="animation--icon"><span></span></span> | ||
<span class="animation--stem"></span> | ||
</div> | ||
<div class="instruct"> | ||
<h1>Alright. Let's roll...</h1> | ||
<p>Select a template from the upper right.</p> | ||
</div> | ||
</div> | ||
</div> | ||
</body> | ||
</html> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
<!DOCTYPE html> | ||
<html lang="en" class="preview-interface-view"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Grunt Email Workflow :: (Preview)</title> | ||
<link rel="stylesheet" href="/css/preview.css"> | ||
</head> | ||
<body> | ||
<div id="header" class="header"> | ||
<div class="header--brand"><a href="https://github.com/leemunroe/grunt-email-workflow" target="_blank">Grunt Email Workflow</a></div> | ||
<div class="header--select"> | ||
Preview: | ||
<select id="template-select"> | ||
<option value="_blank.html">Select a Template</option> | ||
<% templates.forEach(function(template) { %> | ||
<option value="<%= template %>"><%= template %></option> | ||
<% }); %> | ||
</select> | ||
</div> | ||
</div> | ||
<section class="preview-ui"> | ||
<article class="preview-ui--full"> | ||
<div class="preview-ui--full__container"> | ||
<iframe src="_blank.html"></iframe> | ||
</div> | ||
</article> | ||
<!-- http://www.paintcodeapp.com/news/ultimate-guide-to-iphone-resolutions --> | ||
<article id="mobile-drawer" class="preview-ui--mobile"> | ||
<a class="js-drawer-toggle preview-ui--mobile__toggle toggle-drawer-close"></a> | ||
<a class="js-drawer-toggle preview-ui--mobile__toggle toggle-drawer-open"></a> | ||
<div class="preview-ui--mobile__container"> | ||
<iframe src="_blank.html"></iframe> | ||
</div> | ||
</article> | ||
<br style="clear:both;"> | ||
</section> | ||
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> | ||
<script> | ||
(function($) { | ||
// Reusables | ||
var $templateSelect = $('#template-select'), | ||
$body = $('body'), | ||
h = document.location.hash; | ||
// On change, reload template | ||
$templateSelect.on('change', function() { | ||
var $s = $(this), | ||
v = $s.val(), | ||
ms = new Date().getTime(); // We'll timestamp each iframe load for cache-busting | ||
if (!v) | ||
return; | ||
$('iframe').attr('src', v + '?t=' + ms); | ||
document.location.hash = 'template:' + v; | ||
}); | ||
// Preload selected template from hashed template: | ||
if (h && h.indexOf('template:') != -1) { | ||
var tpl = h.split(':')[1]; | ||
$templateSelect.val(tpl).trigger('change'); | ||
} | ||
// Mobile Preview Drawer | ||
function mobilePreviewDrawer() { | ||
var $toggleBtns = $('.js-drawer-toggle'), | ||
$mobileDrawer = $('#mobile-drawer'), | ||
drawerHiddenClass = 'mobile-drawer-hidden'; | ||
$toggleBtns.on('click', function() { | ||
$body.toggleClass(drawerHiddenClass); | ||
}); | ||
} | ||
mobilePreviewDrawer(); | ||
// Debounce helper | ||
// url: http://davidwalsh.name/javascript-debounce-function | ||
function _debounce(func, wait, immediate) { | ||
var timeout; | ||
return function() { | ||
var context = this, args = arguments; | ||
var later = function() { | ||
timeout = null; | ||
if (!immediate) func.apply(context, args); | ||
}; | ||
var callNow = immediate && !timeout; | ||
clearTimeout(timeout); | ||
timeout = setTimeout(later, wait); | ||
if (callNow) func.apply(context, args); | ||
}; | ||
}; | ||
// iFrame Sizing | ||
function resizeUi() { | ||
var headerHeight = $('#header').height(), | ||
windowHeight = $(window).height(), | ||
uiHeightAvail = windowHeight - headerHeight, | ||
$fullHeightEls = $('.preview-ui, .preview-ui--full, .preview-ui--full iframe, .preview-ui--mobile'); | ||
$fullHeightEls.height(uiHeightAvail); | ||
} | ||
// Debouce UI resizing | ||
var resizeUiDebouced = _debounce(function() { | ||
resizeUi(); | ||
}, 200); | ||
window.addEventListener('resize', resizeUiDebouced); | ||
// Trigger UI resize since the page is painted | ||
resizeUi(); | ||
})(jQuery); | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
*, | ||
*:before, | ||
*:after { | ||
box-sizing: border-box; | ||
} | ||
|
||
html, | ||
body { | ||
background: #fff; | ||
margin: 0; | ||
padding: 0; | ||
} |
Oops, something went wrong.