Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

email-templates-effe

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

email-templates-effe

A replacement engine for the node module email-templates and should support Foundation for Emails.

  • 1.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

email-templates-effe

npm version Build Status Coverage Status dependencies Status devDependencies Status license

Email-templates-effe is an alternative engine for email-templates and add support for Foundation for Emails :email::mailbox::rocket:

Dependencies

  • Node.js (requires Angular 6 or higher, tested with v6, v8, v9 and v10)

Installing

install email-templates-effe via npm:

npm install email-templates-effe --save

Or via yarn

yarn add email-templates-effe

Usage

Once installed you need to import the module and set up the root directory for handlebars:

const Email = require('email-templates');
const path = require('path');
const engine = require('email-templates-effe');

// Setup
const email = new Email({
  views: {
    root: path.join(__dirname, 'root/directory/to/all/email/files'),
    options: {
      extension: 'hbs',
      engineSource: engine({
        root: path.join(__dirname, 'handlebars')
      })
    }
  }
});

// Using email engine:
email
  .send({
    template: 'hallo',
    message: {
      to: 'mail@domain.com'
    },
    locals: {
      name: 'John'
    }
  })
  .then(res => {
    console.log('res.originalMessage', res.originalMessage)
  });
  .catch(console.error);

Or you can define all handlebars directory manually with layouts, partials and helpers

// ...Other Code

// Setup
const email = new Email({
  views: {
    root: path.join(__dirname, 'root/directory/to/all/email/files'),
    options: {
      extension: 'hbs',
      engineSource: engine({
        layouts: path.join(__dirname, 'handlebars/layouts'),
        partials: path.join(__dirname, 'handlebars/partials'),
        helpers: path.join(__dirname, 'handlebars/helpers')
      })
    }
  }
});

// ...Other Code

Configuration

configuration optiontypedefaultdescription
rootstring-With root you can define root directory for handlebars with layouts, partials and partials as suborders.
layoutsstring-With layouts you can define an exact handlebars layouts path
partialsstring-With partials you can define an exact handlebars partials path
partialsstring-With partials you can define an exact handlebars partials path

Development

For the development you need Node.js v6 or higher. If you have Node.js installed you can use the following commands to run the test

Using npm:

npm install
npm run test:lint // Run lint test in watch
npm run test:watch // Run unit test in watch mode

or use yarn (yarn must be installed since it is not part of node.js.):

yarn install
yarn run test:lint // Run lint test in watch
yarn run test:watch // Run unit test in watch mode

Built With

  • bluebird - Good and fast promise library
  • cheerio - It's like jQuery for Server
  • front-matter - Extract meta data from documents.
  • glob - Match files using the patterns used by the shell
  • handlebars - Handlebars is a template engine
  • inky - Inky is a template engine for Foundation for Emails tags
  • lodash - A helper library
  • strip-bom - Strip UTF-8 byte order mark (BOM) from a string

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

  • Nico Swiatecki - Initial work - Snics

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE file for details

Keywords

FAQs

Package last updated on 28 May 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc