Tailwind CSS Config

Maizzle comes with an email-tailored tailwind.config.js

Spacing units

Because they are poorly supported in email, rem units have been replaced with px ones, with values better suited for email client viewports.

!important

Emails still need to use inline CSS, most notably for these reasons:

  • Outlook only reads the first class in a class="" attribute, and ignores the rest. So it'll only use a from class="a b"
  • Some email clients don't support embedded CSS (i.e. in <style>)

Because of this, the important option is set to true, in order for the responsive utilities to actually override inlined CSS:

// tailwind.config.js
module.exports = {
  important: true,
}

Separator

Separators like : in hover:bg-black or / in w-1/2 need to be \escaped in CSS.

Because some email clients (Gmail 👀) fail to parse selectors with escaped characters, Maizzle normalizes all your CSS selectors and HTML classes, replacing any escaped characters it finds with -.

So you can safely use Tailwind's awesome default separator and write classes like sm:w-1/2 - Maizzle will convert that to sm-w-1-2 in your compiled template:

// tailwind.config.js
module.exports = {
  separator: ':',
  theme: {
    width: {
      '1/2': '50%', // w-1-2
      '50%': '50%', // w-50pc
    }
  }
}

Screens

A custom set of @media query breakpoints is defined.

Maizzle uses a desktop-first approach with max-width, instead of Tailwind's default mobile-first with min-width. Of course, you're free to adjust these as you like:

screens: {
  all: {'raw': 'screen'},
  sm: {'max': '600px'},
},

@screen all

This creates an @media screen {} query. You can use it for things like:

  • defining (web) font stacks for modern email clients
  • preventing Juice from inlining a utility class

@screen sm

A breakpoint for mobile devices, adjust as needed.

More on screens, in the Tailwind CSS docs ↗

Plugins

Maizzle comes with the tailwindcss-gradients plugin. See the Gradients docs for examples showing how to configure and use it.

Of course, you can add any plugin you want, like CSS grid or border image gradients.