<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Ezra Mechaber</title>
    <description>The latest articles on DEV Community by Ezra Mechaber (@ezramechaber).</description>
    <link>https://dev.to/ezramechaber</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F196381%2Fafc0c350-d557-49d1-ae0a-4897c50169f5.jpeg</url>
      <title>DEV Community: Ezra Mechaber</title>
      <link>https://dev.to/ezramechaber</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ezramechaber"/>
    <language>en</language>
    <item>
      <title>How To Take The Headache Out Of CSS And HTML In Emails</title>
      <dc:creator>Ezra Mechaber</dc:creator>
      <pubDate>Wed, 04 Mar 2020 15:53:12 +0000</pubDate>
      <link>https://dev.to/glitch/how-to-take-the-headache-out-of-css-and-html-in-emails-2kf0</link>
      <guid>https://dev.to/glitch/how-to-take-the-headache-out-of-css-and-html-in-emails-2kf0</guid>
      <description>&lt;p&gt;I recently went down a rabbit-hole of creating a high-powered email workflow using &lt;a href="http://glitch.com?utm_medium=weblink&amp;amp;utm_source=dev.to&amp;amp;utm_campaign=blog&amp;amp;utm_content=dev"&gt;Glitch&lt;/a&gt; to code, compile, and preview our HTML marketing emails.&lt;/p&gt;

&lt;p&gt;It was so useful to me to be able to do all of that in one place that I created a guide for how you can do the same.&lt;/p&gt;

&lt;h2&gt;
  
  
  Who is this post for?
&lt;/h2&gt;

&lt;p&gt;If you send emails, this post is for you. &lt;br&gt;
Maybe you send emails as part of your job or as a side-gig or even for fun. You might use Mailchimp, TinyLetter, Customer.io or one of the literally million other services out there.&lt;/p&gt;

&lt;p&gt;This post is &lt;em&gt;definitely&lt;/em&gt; for you if you have found yourself coding your emails in raw HTML rather than a drag-and-drop builder.&lt;/p&gt;

&lt;p&gt;And this is &lt;em&gt;most definitely&lt;/em&gt; for you if you like advanced style sheets.&lt;/p&gt;

&lt;h2&gt;
  
  
  The problem is email
&lt;/h2&gt;

&lt;p&gt;Or, more accurately, email clients. See, they all have a terribly mismatched set of requirements for rendering email. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fo3bautwxcx0o7sl01afg.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fo3bautwxcx0o7sl01afg.jpeg" alt="Clippy"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Some Outlook clients (I know) even use old Microsoft Word engines to render their email (I KNOW).&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Some clients don't respect style sheets entirely, while others don't respect certain parts of style sheets. It's a whole thing.&lt;/p&gt;

&lt;p&gt;So the best practice in our funny corner of the world is to inline as many styles as possible.&lt;/p&gt;

&lt;p&gt;Customizing emails with inline styles is hard work, especially when you have to do it again, and again, and again.&lt;/p&gt;

&lt;p&gt;This is so frustrating that lots of new tools have cropped up to do this for you. Take Automattic's &lt;a href="https://github.com/Automattic/juice" rel="noopener noreferrer"&gt;Juice&lt;/a&gt; or Litmus' &lt;a href="https://litmus.com/email-builder" rel="noopener noreferrer"&gt;paid email builder&lt;/a&gt;. All great!&lt;/p&gt;

&lt;p&gt;But some aren't free and some only solve a piece of the puzzle.&lt;/p&gt;

&lt;h2&gt;
  
  
  The solution is a task runner
&lt;/h2&gt;

&lt;p&gt;A task runner (like &lt;a href="https://gruntjs.com/" rel="noopener noreferrer"&gt;Grunt&lt;/a&gt;) combines a number of different chores into one execution step. &lt;/p&gt;

&lt;p&gt;I know very little about JavaScript, but I do know how to follow READMEs and tinker until I break things and get them working again.&lt;/p&gt;

&lt;p&gt;So when I came across Grunt and finally understood it, it rocked my little email world. Especially when I found &lt;a href="https://github.com/leemunroe/grunt-email-workflow/" rel="noopener noreferrer"&gt;Lee Munroe's grunt-email-workflow&lt;/a&gt;. I could use SCSS (fancy CSS) and inline it all at the same time, keeping my templates clean while I coded but outputting everything I needed.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F4t7jlrbkzr8iceu38ed6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F4t7jlrbkzr8iceu38ed6.png" alt="Grunt logo"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once I got it up and running (and customized), thanks to the magic of Glitch's Preview functionality, I could see the live previews at the drop of a hat.&lt;/p&gt;

&lt;h2&gt;
  
  
  What does this task runner do?
&lt;/h2&gt;

&lt;p&gt;Using some basic modules, I created a Glitch app that does a few main things:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Takes SCSS/Sass partials and combines them into a unified stylesheet&lt;/li&gt;
&lt;li&gt;Takes that stylesheet and inlines all of the styles into a single HTML file&lt;/li&gt;
&lt;li&gt;Loads that HTML into a preview file that you can copy/paste directly into your email client.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  How do I use it?
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Go Glitch.com 🎏 and create an account if you haven't already.&lt;/li&gt;
&lt;li&gt;Head to the project &lt;a href="https://glitch.com/edit/#!/grunt-for-email" rel="noopener noreferrer"&gt;grunt-for-email&lt;/a&gt; and hit remix for your own version of the very same. You'll need to update a couple small things like some fixed links in &lt;code&gt;/public/index.html&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Make it a private project if you want your code to be just for you.&lt;/li&gt;
&lt;li&gt;Follow the readme to customize your folders and your workflow.
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fvl6r30rij8gz4a577ohk.gif" alt="Exploring the file tree"&gt;
&lt;/li&gt;
&lt;li&gt;Start running your own tasks.
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fkyf79cv44i51u2zcvfw1.gif" alt="Compile using the code in the readme"&gt;
&lt;/li&gt;
&lt;li&gt;Hit "Show" &amp;gt; "Show Next to Code" for some sweet, sweet previewing.
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fh86whf6u8d3lu3nlkvxj.gif" alt="Live preview demonstration"&gt;
&lt;/li&gt;
&lt;li&gt;For extra fun, check out the additional resources in the README.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If you've got questions or feedback, feel free to leave a comment! And if you find this tool useful, please Unicorn 🦄 this post.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;We're launching some exciting new features on Glitch real soon. &lt;a href="https://glitch.com/coming-soon?utm_medium=weblink&amp;amp;utm_source=dev.to&amp;amp;utm_campaign=blog&amp;amp;utm_content=dev"&gt;Be the first to know&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>productivity</category>
      <category>css</category>
      <category>node</category>
    </item>
  </channel>
</rss>
