From 3f2146f45f0356b5128466f7148312c270dcbb5c Mon Sep 17 00:00:00 2001 From: ErickSkrauch Date: Wed, 5 Jun 2019 22:55:17 +0300 Subject: [PATCH] Readme.md --- README.md | 48 +++++++++++++++++++++++++++++++++++------------- package.json | 8 +++++++- 2 files changed, 42 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 2e456b3..f9cad58 100644 --- a/README.md +++ b/README.md @@ -1,21 +1,43 @@ -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: +# E-mails renderer -``` -node cli --type= --payload= [--assetsHost=] [--locale=be] +An internal tool used to render beautiful multilingual E-mail templates on the Accounts Ely.by project. +The template engine uses React.js components, which are rendered into pure HTML with inlined styles, ready to be sent +to the mail. + +Each directory in `emails` dir corresponds to separate email template. Each email component will receive payload, passed from command line: + +## Development + +First of all you need a copy of the repository. If you are planning to send a Pull Request, first +[create a fork](https://help.github.com/en/articles/fork-a-repo) of the repository. Then run the following commands: + +```sh +# Clone your fork +git clone https://github.com//emails-renderer.git +# Switch to the project folder +cd emails-renderer +# Install dependencies +yarn install ``` -Try `php example.php` for demo. +For the purpose of development, the project has a convenient development server and a toolbar that simplifies +templates debugging. To run it, use the `start` command: -# Email component structure +```sh +yarn start +``` -* `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. +The server will be started at port `8080`. You can open it in your browser by going to `http://localhost:8080`. + +### Email component structure + +* `index.ts` — required. This file should export the main component, which will receive payloads. +* `fixtures.ts` — an optional file exports hash `{featureId: payload, featureId2: payload}`. + Use this to create data samples for testing in dev mode. +* `styles.ts` — an optional file, that will hold styles objects for email components to allow styles inlining. * `messages.intl.json` — an optional file, that exports hash with `{messageId: defaultMessage}` for `react-intl`. -# Available npm scripts +## Translating -* `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. +Ely.by translation is done through the [Crowdin](https://crowdin.com) service. +[Click here](https://translate.ely.by/project/elyby/invite) to participate in the translation of the project. diff --git a/package.json b/package.json index 923391c..a6bb7b5 100644 --- a/package.json +++ b/package.json @@ -1,13 +1,19 @@ { "name": "@elyby/emails-renderer", "version": "1.0.0", - "description": "", + "description": "Tool for rendering multilingual templates sent to E-mail", "main": "dist/app.js", "repository": { "type": "git", "url": "https://github.com/elyby/emails-renderer" }, "author": "SleepWalker ", + "maintainers": [ + { + "name": "ErickSkrauch", + "email": "erickskrauch@ely.by" + } + ], "license": "Apache-2.0", "bugs": { "url": "https://github.com/elyby/emails-renderer/issues"