Tool for rendering multilingual templates sent to E-mail
Go to file
2019-06-03 01:57:13 +03:00
scripts Integrate crowdin and pull locales 2019-05-11 01:16:21 +03:00
src Integrate @elyby/eslint-plugin and apply its fixes 2019-05-28 23:42:13 +03:00
webpack-utils Allow to customize base resources root for rendered text images 2019-06-03 01:57:13 +03:00
.eslintrc.js Integrate @elyby/eslint-plugin and apply its fixes 2019-05-28 23:42:13 +03:00
.gitignore Cleanup 2019-06-01 13:41:20 +03:00
package.json Integrate @elyby/eslint-plugin and apply its fixes 2019-05-28 23:42:13 +03:00
README.md Use files instead of data uri. Added option to define assetsHost 2016-09-27 08:02:19 +03:00
tsconfig.json Migrate project's code base to TypeScript 2019-05-13 02:27:07 +03:00
webpack.config.js Rewrite src/index.tsx to solve TS error with react-intl typings 2019-05-19 20:46:49 +03:00
yarn.lock Upgrade dependencies 2019-05-28 23:47:48 +03:00

This package allows rendering of React components into plain HTML to use it in emails. Each directory in emails dir corresponds to separate email template. Each email component will receive payload, passed from command line:

node cli --type=<email_dir_name> --payload=<json_encoded_in_base64> [--assetsHost=<scheme://host:port>] [--locale=be]

Try php example.php for demo.

Email component structure

  • index.js — required. This file should export the main component, wich will receive payload.
  • fixtures.js — an optional file exports hash {featureId: payload, featureId2: payload}. Use this to create data samples for testing in dev mode.
  • styles.js — an optional file, that will hold style objects for email components to allow style inlining.
  • messages.intl.json — an optional file, that exports hash with {messageId: defaultMessage} for react-intl.

Available npm scripts

  • npm start — starts app in dev mode.
  • npm run i18n — collects translations and places in src/i18n.
  • npm run build — builds app for usage in cli.js.
  • npm run eslint — lints source files.