• Stars
    star
    3,110
  • Rank 13,888 (Top 0.3 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created almost 3 years ago
  • Updated 6 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Use Tailwind CSS to design HTML emails.

Mailwind

Use Tailwind CSS to design HTML emails.

Tailwind makes it very easy to design websites, why not use it to design HTML emails? I've been using this for volt.fm and pikaso.me and it has made my life a lot easier.

Install

npm install -g mailwind

Usage

Design your HTML email using the Tailwind utility classes like you normally would for the web.

Then run the following command to generate the corresponding CSS file:

mailwind --input-html email.html --output-css style.css

Or run this command to generate an inlined HTML file:

mailwind --input-html email.html --output-html email-inlined.html

Options

--input-css

The path to your base CSS file. Use this if you need to write custom CSS. Defaults to style.css.

--input-html

The path to your HTML email file.

--output-css

The path to the CSS file that will be generated.

--output-html

The path to the inlined HTML file that will be generated.

--tailwind-config

The path to your custom Tailwind configuration file. Defaults to tailwind.config.js.

Note

In the provided default config file, all the units are changed to pixel which is probably what you want for HTML emails.

Example

Given an email.html file with this content:

<html>
  <body>
    <p class="font-bold text-lg">Welcome</p>
  </body>
</html>

running this command:

mailwind \
  --input-html email.html \
  --output-css style.css \
  --output-html email-inlined.html

will generate the following CSS and inlined HTML files:

.text-lg {
  font-size: 18px
}

.font-bold {
  font-weight: 700
}
<html>
  <body>
    <p class="font-bold text-lg" style="font-size: 18px; font-weight: 700;">Welcome</p>
  </body>
</html>

Version History

  • 2.2
    • Tailwind CSS is now a peer dependency so you can npm install newer versions if you need to (Thanks Songkeys)
  • 2.1
    • Colors are now generated without using CSS variables
    • Upgrade to Tailwind CSS v3.2
  • 2.0
    • New design
    • Upgrade to Tailwind CSS v3
  • 1.0
    • Initial release

Author

Soheil Rashidi

Copyright and License

Copyright 2022 Soheil Rashidi.

Licensed under the The MIT License (the "License"); you may not use this work except in compliance with the License. You may obtain a copy of the License in the LICENSE file, or at:

http://www.opensource.org/licenses/mit-license.php

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

More Repositories

1

catj

Displays JSON files in a flat format.
1,324
star
2

pgcmd

Non-interactive PostgreSQL query tool.
JavaScript
116
star
3

mon

Painless performance monitoring for Windows.
JavaScript
77
star
4

traq

Super simple email open/click tracking server.
JavaScript
67
star
5

sqltop

Find the most resource consuming SQL Server queries.
JavaScript
37
star
6

mann

With mann you will never forget command line options again.
JavaScript
35
star
7

sqlmon

Collects events from SQL Server and saves them to Elasticsearch for further analysis.
JavaScript
35
star
8

sqlcmd

sqlcmd for Mac and Linux.
JavaScript
21
star
9

Sherlock-iOS

A simple password and personal information manager for iOS with Dropbox and Google Drive support.
Objective-C
16
star
10

Clipboard

Cross-platform clipboard library for .NET Core.
C#
14
star
11

Ledger

Interactive CLI double-entry accounting application.
C#
10
star
12

zsh-vi-search

Adds support for searching the current line (in normal vi mode) to zsh.
Shell
10
star
13

buno

Run custom scripts before and after executing a command.
JavaScript
10
star
14

Xinq

Easily manage database queries inside Visual Studio.
C#
8
star
15

DueNext

An iPhone app that displays upcoming events from your calendars in a simple and easy-to-read list.
Objective-C
7
star
16

nautilus

Modern issue tracker.
TypeScript
6
star
17

nestbreak

A Twitter API proxy in Node.js
JavaScript
5
star
18

youtrack2gitlab

Import YouTrack issues into GitLab.
JavaScript
4
star
19

jalalify

Detects and converts dates in the input stream from Gregorian to Jalali and vice versa.
JavaScript
4
star
20

HTTPKit

A simple and extremely lightweight asynchronous HTTP library for Objective-C.
Objective-C
3
star
21

tweetever

Keep your tweets forever with this little Node.js app.
JavaScript
2
star
22

deligle

An extention for Google Chrome that displays matching links from your Delicious bookmarks in Google search results.
JavaScript
2
star
23

Rhapsody

An easy to use ID3 Tag editor for Windows.
C#
2
star
24

Sherlock-MacCLI

A simple console password and personal information manager for Mac.
Objective-C
2
star
25

concert-finder

An alternative user interface for songkick.com.
JavaScript
2
star
26

postchi

Send email from the command line using SMTP or major service providers.
JavaScript
1
star
27

Sherlock-CLI

Cross-platform password and personal information manager.
C#
1
star
28

swing

C
1
star
29

xformat

Simple templating for the command line.
JavaScript
1
star
30

Sherlock-Win

A simple password and personal information manager for Windows.
C#
1
star
31

xcodefly

Speeds up Xcode builds by moving the DerivedData folder to a RAM disk.
Shell
1
star