npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

mjml-signoff

v1.2.3

Published

A bulletproof photo-plus-closing sign-off element for your MJML emails.

Downloads

22

Readme

npm GitHub release (latest SemVer) Release Date MJML 4.0+ valid License: AGPL-3.0+ Pull Requests welcome


This MJML component is brought to you by Premail, and the following documentation can also be found at https://premail.dev/docs/components/mjml-signoff


Designed for the sign-off or signature section at the bottom of your email content, the <mj-signoff> tag allows you to easily include an image alongside your signature such as a photo or logo, which is a common best practice in many types of emails:

Example of generated markup from the MJML Signoff component


Usage

Coding

This MJML:

<mjml>
  <mj-body>
    <mj-section>
      <mj-column>
        <mj-signoff
          closing="Thank you,"
          name="John Q. Public"
          title="Your Friendly Neighbor"
          image-src="https://picsum.photos/75/100"
          image-width="75px"
          image-height="100px"
          image-alt=""
        >
          <p><a href="https://example.com">Example, Inc.</a></p>
        </mj-signoff>
      </mj-column>
    </mj-section>
  </mj-body>
</mjml>

Will produce the following visual representation:

Example of generated markup from the MJML Signoff component

The closing, name and title strings are all optional, as are an additional title2 and title3 strings. These strings cannot contain HTML elements, however any content within the element itself is placed in the text column below the optional strings -- for instance, the wrapped and linked company name shown above. <mj-signoff> need not have any content within its tags, however.

The wrapper <p> and <div> elements are only inserted if the corresponding strings are set. A simplified version of the generated HTML is:

<div class="signoff">
  <!-- table markup -->
  <div class="signoff__image-wrapper">
    <!-- table markup, class="signoff__image" -->
    <img />
    <!-- table markup -->
  </div>
  <div class="signoff__text-wrapper">
    <!-- table markup, class="signoff__text" -->
    <p class="signoff__closing"><!-- if string is set --></p>
    <p class="signoff__name"><!-- if string is set --></p>
    <p class="signoff__title"><!-- if string is set --></p>
    <p class="signoff__title2"><!-- if string is set --></p>
    <p class="signoff__title3"><!-- if string is set --></p>
    <div class="signoff__custom">
      <!-- if <mj-signoff> element has content -->
    </div>
    <!-- table markup -->
  </div>
  <!-- table markup -->
</div>

The order of the image and text columns is reversed if image-position is set to right.

Styling

The following mj-class elements are available for styling with <mj-attributes>:

  • signoff
  • signoff__image-wrapper
  • signoff__image
  • signoff__text-wrapper
  • signoff__text

And the following CSS classes are available for styling with <mj-style>:

  • signoff
  • signoff__image-wrapper
  • signoff__image
  • signoff__text-wrapper
  • signoff__text
  • signoff__closing
  • signoff__name
  • signoff__title
  • signoff__title2
  • signoff__title3
  • signoff__custom

You can see how each of these are used in the example MJML file.

Options

Available options for <mj-signoff>:

| option | unit | details | default value | | --------------------- | ------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------- | | closing | string | Optional closing, e.g. Thank you, | none | | name | string | Optional name, e.g. John Q. Public | none | | title | string | Optional title, e.g. Your Friendly Neighbor | none | | title2 | string | Optional title line two, e.g. Example, Inc. | none | | title3 | string | Optional title line three, e.g. (202) 555-1212 | none | | section-padding | pixels | Applies to entire element | 10px 0 | | section-align | left, center, right | Alignment of element as a whole | left | | background-color | color | Applies to entire element | none | | image-position | left, right | Where the image should appear relative to the text | left | | image-padding | pixels | Applies only to the image column | none | | image-src | URL | Location of image | none | | image-width | pixels | Width of image | none | | image-height | pixels | Height of image | none | | image-alt | string | Alternative text for image (you may legitimately wish to leave this blank; see the spec for graphical representation, decorative images and example 2 here) | none | | text-column-padding | pixels | Applies only to the text column | 0 10px |

Adding this to your emails

In your MJML project directory, install this package via npm:

npm install mjml-signoff

In your build process script (such as gulp), require the package:

const mjmlSignoff = require('mjml-signoff')

or

import mjmlSignoff from mjml-signoff

Finally, add the package to your .mjmlconfig:

{
  "packages": ["mjml-signoff"]
}

You can now use <mj-signoff> in your MJML emails.

Fork or contribute to this component

If you want to edit this component, first grab it via git:

git clone https://github.com/premail/mjml-signoff.git

Navigate to the folder and install:

cd mjml-signoff
npm install

Edit the component script file in ./components/, then run gulp build or gulp watch to compile. We include sheerun/modern-node, which formats and lints code automatically on commits using Prettier and ESLint. You can use npm run format and npm run lint on their own as well.

To run tests, use npm run test

If you want to use a forked version of this component in your emails without having to publish it to npm, see premail/mjml-custom-component for a guide.

Alternatives

As an alternative to <mjml-signoff>, you can use the <mj-group> element, but note its warning for iOS 9.

If you are not using an image in your sign-off, or you are including an image on a line by itself (such as an image of a signature) you can simply use the default <mj-image> and <mj-text> elements.

Security

Legalese: This component is provided "as is" without any warranty. Use at your own risk.

For more information and to report security issues, please refer to our security documentation.

License

mjml-signoff is licensed under the GNU Affero General Public License v3.0 or later. To be clear: This license only covers the component's code, not any content you generate using it.

For the legal details of the AGPL, see the complete LICENSE.