Skip to content

trophyso/email-builder-js

 
 

Repository files navigation

Trophy Email Builder

This is a fork of usewaypoint/email-builder-js with some modifications to allow for the types of emails we need to send at Trophy.

Installation

npm install @trophy/email-builder-js

Usage

import { EmailBuilder } from '@trophy/email-builder-js';
import { renderToStaticMarkup, TReaderDocument } from '@trophyso/email-builder-js';

const document: TReaderDocument = {
  // Document content here
};

const html = renderToStaticMarkup(document, { rootBlockId: 'root' });

Development

This package is written in TypeScript. npm install will install all packages, including in nested folders (each block is its own package, with its own package.json).

All code is tested using jest. To run the tests, run:

npm test

After making changes to a component, if you've verified that it looks correct, simply delete the __snapshots__ folder and run the tests again to update the snapshots.

To build the package, tick the version number and run:

npm run build && npm publish

For local development with the Trophy app, you can link the package to the Trophy app by setting the dependency to the local repo from the Trophy app:

{
  "dependencies": {
    "@trophy/email-builder": "file:../email-builder-js"
  }
}

Then run:

npm install

This will symlink this email-builder-js dist folder to the node_modules folder of the Trophy app, so you only need to npm run build to see the changes immediately reflected in the Trophy app.

Packages are built automatically when pushed to the main branch.

About

Block-based email template builder based on usewaypoint/email-builder-js

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 99.7%
  • HTML 0.3%