0.0.1 • Published 5 years ago

gulp-email-builder-min v0.0.1

Weekly downloads
-
License
MIT
Repository
bitbucket
Last release
5 years ago

gulp-email-builder-min

Uses Email Builder Core Min to inline css into HTML tags and send test emails to yourself.

Example:

<!DOCTYPE html>
<html>
<head>
  <!-- styles will be inlined -->
  <link rel="stylesheet" type="text/css" href="../css/styles.css">

  <!-- styles will be embedded -->
  <link rel="stylesheet" type="text/css" href="../css/otherStyles.css" data-embed>

  <!-- link tag will be preserved and styles will not be inlined or embedded -->
  <link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css' data-embed-ignore>

  <!-- styles will be inlined -->
  <style>
    p { color: red; }
  </style>

  <!-- styles will be embedded -->
  <style data-embed>
    h1 { color: black; }
  </style>
</head>
<body>
  <h1>Heading</h1>
  <p>Body</p>
</body>
</html>

You can see an example setups below

Getting Started

Install this gulp plugin next to your project's gulpfile with: npm install gulp-email-builder-min

Then add this line to your project's gulp.js gulp:

const emailBuilder = require('gulp-email-builder-min');

Documentation

Place this in your gulp file.

  gulp.task('emailBuilder', () => {
    return gulp.src(['./example/html/*.html'])
      .pipe(emailBuilder(options).build())
      .pipe(gulp.dest('./example/dist/'));
  });

Other available methods

Besides the main emailBuilder(options).build() function, the email-builder-core methods are exposed so users can use them on an individual basis.

  • emailBuilder(options).inlineCss()
  • emailBuilder(options).sendEmailTest()

Example

...
.pipe(emailBuilder(options).sendEmailTest())
...

Options

View Email Builder Core Min Options for all available options.

Complete Example

const EmailBuilder = require('gulp-email-builder');

const options = { encodeSpecialChars: true }
const builder = EmailBuilder(options);

gulp.task('emailBuilder', () => {
  return gulp.src(['./example/html/*.html'])
    .pipe(builder.build())
    .pipe(gulp.dest('./example/dist/'));
});

Thanks

The original Email Builder Core Team:

Jeremy Peter (https://github.com/jeremypeter)

Steve Miller (http://www.stevenjohnmiller.com.au)

License

MIT