Since we're using Laravel Blade, we can use its directives to pull in reusable blocks of code. More, we can even create our own @ directives for components and dynamic content.


You can use the @include() directive in Blade to pull reusable sections into your emails.

For example, Maizzle does this in the master layout with the email.blade.php partial, to pull in the compiled CSS together with an Outlook-specific block of code:

First, create a partial file in source/_partials

// source/_partials/sidebar.blade.php


Then, use @include() to pull it in a layout or a page:


Of course, being a Blade file, your partial can contain both HTML and Blade syntax, and even plain PHP.


Blade Components & Slots are also supported.

You can use them as in the Blade docs or, because we're using Jigsaw, you can even register component aliases.

Registering Component Aliases

You can register a Blade component alias inside blade.php, as described here.

Maizzle currently comes with one component alias: an Outlook VML background image component. The component file is a Blade file in the source/_components directory:

// source/_components/vmlbg.blade.php

<!--[if mso]>
<v:image src="{{ $src }}" xmlns:v="urn:schemas-microsoft-com:vml" style="width:{{ $width }}px;height:{{ $height }}px;" />
<v:rect fill="false" stroke="false" style="position:absolute;width:{{ $width }}px;height:{{ $height }}px;">
{{ $slot }}
<!--[if mso]></div></v:rect><![endif]-->

Then, we simply register it in blade.php:

// blade.php


We can now use it in a layout or page:

@vmlbg(['src' => '', 'width' => 600, 'height' => 400])
    // your HTML to be overlayed on top of the image