email-template/README.md

143 lines
5.4 KiB
Markdown
Raw Normal View History

2020-07-21 09:39:09 +02:00
# Email template for ReadLater ![Panini](https://img.shields.io/badge/language-panini-blue.svg) ![Inky](https://img.shields.io/badge/language-inky-blue.svg)
2020-07-01 15:29:05 +02:00
2020-07-21 09:39:09 +02:00
> [Foundation for Emails](http://foundation.zurb.com/emails) Template
2020-07-01 15:29:05 +02:00
2020-07-21 09:39:09 +02:00
## :books: Table of Contents
2020-07-01 15:29:05 +02:00
2020-07-21 09:39:09 +02:00
- [Installation](#package-installation)
- [Usage](#rocket-usage)
- [Support](#hammer_and_wrench-support)
- [Contributing](#memo-contributing)
- [License](#scroll-license)
2020-07-01 15:29:05 +02:00
2020-07-21 09:39:09 +02:00
## :package: Installation
2020-07-01 15:29:05 +02:00
To use this template, your computer needs [Node.js](https://nodejs.org/en/) 0.12 or greater. The template can be installed with the Foundation CLI, or downloaded and set up manually.
### Using the CLI
Install the Foundation CLI with this command:
```bash
npm install foundation-cli --global
```
2020-07-21 09:39:09 +02:00
### Then install this script
2020-07-01 15:29:05 +02:00
2020-07-21 09:39:09 +02:00
```sh
git clone ssh://gogs@git.shikiryu.com:2200/ReadLaterByEmail/email-template.git
cd email-template
2020-07-01 15:29:05 +02:00
npm install
```
2020-07-21 09:39:09 +02:00
## :rocket: Usage
2020-07-01 15:29:05 +02:00
Run `npm start` to kick off the build process. A new browser tab will open with a server pointing to your project files.
Run `npm run build` to inline your CSS into your HTML along with the rest of the build process.
Run `npm run litmus` to build as above, then submit to litmus for testing. *AWS S3 Account details required (config.json)*
Run `npm run mail` to build as above, then send to specified email address for testing. *SMTP server details required (config.json)*
2020-07-21 09:39:09 +02:00
Run `npm run zip` to build as above, then zip HTML and images for easy deployment to email marketing services.
### Details on content
* [Inky doc](https://get.foundation/emails/docs/inky.html)
* [Foundation doc](https://get.foundation/emails/docs/)
* [Blade doc](https://laravel.com/docs/7.x/blade)
As this project is used to make email sent by a Laravel app, every dynamic element must be indicated in the front-matter as such :
```
---
TITLE: "{{ $link->title }}"
---
```
and it should be in the code as such
```
{{{ TITLE }}}
```
`@if()` and all blades control structures can be used.
2020-07-01 15:29:05 +02:00
### Speeding Up Your Build
If you create a lot of emails, your build can start to slow down, as each build rebuilds all of the emails in the
repository. A simple way to keep it fast is to archive emails you no longer need by moving the pages into `src/pages/archive`.
You can also move images that are no longer needed into `src/assets/img/archive`. The build will ignore pages and images that
are inside the archive folder.
2020-07-21 09:39:09 +02:00
### Litmus Tests (config.json)
2020-07-01 15:29:05 +02:00
Testing in Litmus requires the images to be hosted publicly. The provided gulp task handles this by automating hosting to an AWS S3 account. Provide your Litmus and AWS S3 account details in the `example.config.json` and then rename to `config.json`. Litmus config, and `aws.url` are required, however if you follow the [aws-sdk suggestions](http://docs.aws.amazon.com/AWSJavaScriptSDK/guide/node-configuring.html) you don't need to supply the AWS credentials into this JSON.
```json
{
"aws": {
"region": "us-east-1",
"accessKeyId": "YOUR_ACCOUNT_KEY",
"secretAccessKey": "YOUR_ACCOUNT_SECRET",
"params": {
"Bucket": "elasticbeanstalk-us-east-1-THIS_IS_JUST_AN_EXAMPLE"
},
"url": "https://s3.amazonaws.com/elasticbeanstalk-us-east-1-THIS_IS_JUST_AN_EXAMPLE"
},
"litmus": {
"username": "YOUR_LITMUS@EMAIL.com",
"password": "YOUR_ACCOUNT_PASSWORD",
"url": "https://YOUR_ACCOUNT.litmus.com",
"applications": ["ol2003","ol2007","ol2010","ol2011","ol2013","chromegmailnew","chromeyahoo","appmail9","iphone5s","ipad","android4","androidgmailapp"]
}
}
```
## Manual email tests (config.json)
Similar to the Litmus tests, you can have the emails sent to a specified email address. Just like with the Litmus tests, you will need to provide AWS S3 account details in `config.json`. You will also need to specify to details of an SMTP server. The email address to send to emails to can either by configured in the `package.json` file or added as a parameter like so: `npm run mail -- --to="example.com"`
```json
{
"aws": {
"region": "us-east-1",
"accessKeyId": "YOUR_ACCOUNT_KEY",
"secretAccessKey": "YOUR_ACCOUNT_SECRET",
"params": {
"Bucket": "elasticbeanstalk-us-east-1-THIS_IS_JUST_AN_EXAMPLE"
},
"url": "https://s3.amazonaws.com/elasticbeanstalk-us-east-1-THIS_IS_JUST_AN_EXAMPLE"
},
"mail": {
"to": [
"example@domain.com"
],
"from": "Company name <info@company.com",
"smtp": {
"auth": {
"user": "example@domain.com",
"pass": "12345678"
},
"host": "smtp.domain.com",
"secureConnection": true,
"port": 465
}
}
}
```
For a full list of Litmus' supported test clients(applications) see their [client list](https://litmus.com/emails/clients.xml).
**Caution:** AWS Service Fees will result, however, are usually very low do to minimal traffic. Use at your own discretion.
2020-07-21 09:39:09 +02:00
## :hammer_and_wrench: Support
Please [open an issue](https://git.shikiryu.com/ReadLaterByEmail/email-template/issues/new) for support.
## :memo: Contributing
Please contribute using [Github Flow](https://guides.github.com/introduction/flow/). Create a branch, add commits, and [open a pull request](https://git.shikiryu.com/ReadLaterByEmail/email-template/compare/main...main).
## :scroll: License
[Creative Commons Attribution NonCommercial (CC-BY-NC)](<https://tldrlegal.com/license/creative-commons-attribution-noncommercial-(cc-nc)>) © [Chouchen](https://github.com/Chouchen/)