Skip to content

avigoldman/postcss-target-email

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

postcss-target-email

Adds @client media queries to allow you to target different email clients.

Installation

npm install postcss-target-email --save

Usage

postcss([ require('postcss-target-email')({ comment: false, bodyClass: '.body' }) ])
// do your processing here 🎉

Or use it in some other PostCSS way.

Options

comment

Default: false

Use this option to define whether or not to add documenting comments above CSS.

bodyClass

Default: .body

Use this option to set the class on your body. This is required to properly target your CSS.

Example

If you want to style all links on Gmail and Yahoo be colored orange you would write the following:

@client gmail, yahoo {
  a {
    color: orange;
  }
}

You will get this result:

/**
 * Targeting gmail
 */
u + .body a {
  color: orange;
}

/**
 * Targeting yahoo
 */
@media screen yahoo {
  a {
    color: orange;
  }
}

Supported Clients

At the moment this package supports targeting the following clients.

  • aol
  • yahoo
  • gmail
  • outlook-com
  • thunderbird
  • samsung
  • lotusnotes8
  • webkit (not really a client, but quite helpful)

Sources

This package is entirely dependent on the amazing work of people in the email community.

Related

Releases

No releases published

Packages

No packages published