Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions src/mail/bin/html-to-plain-text
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
#!/usr/bin/env bash
set -eo pipefail
# Run html-to-text to convert all html files to text files
DIR_MAILS="../backend/core/templates/mail/"
DOCS_DIR_MAILS="${DOCS_DIR_MAILS:-../backend/core/templates/mail}/"

if [ ! -d "${DIR_MAILS}" ]; then
mkdir -p "${DIR_MAILS}";
if [ ! -d "${DOCS_DIR_MAILS}" ]; then
mkdir -p "${DOCS_DIR_MAILS}";
fi

if [ ! -d "${DIR_MAILS}"html/ ]; then
mkdir -p "${DIR_MAILS}"html/;
if [ ! -d "${DOCS_DIR_MAILS}"html/ ]; then
mkdir -p "${DOCS_DIR_MAILS}"html/;
exit;
fi

for file in "${DIR_MAILS}"html/*.html;
for file in "${DOCS_DIR_MAILS}"html/*.html;
do html-to-text -j ./html-to-text.config.json < "$file" > "${file%.html}".txt; done;

if [ ! -d "${DIR_MAILS}"text/ ]; then
mkdir -p "${DIR_MAILS}"text/;
if [ ! -d "${DOCS_DIR_MAILS}"text/ ]; then
mkdir -p "${DOCS_DIR_MAILS}"text/;
fi

mv "${DIR_MAILS}"html/*.txt "${DIR_MAILS}"text/;
mv "${DOCS_DIR_MAILS}"html/*.txt "${DOCS_DIR_MAILS}"text/;
8 changes: 4 additions & 4 deletions src/mail/bin/mjml-to-html
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/usr/bin/env bash

# Run mjml command to convert all mjml templates to html files
DIR_MAILS="../backend/core/templates/mail/html/"
DOCS_DIR_MAILS="${DOCS_DIR_MAILS:-../backend/core/templates/mail}/html/"

if [ ! -d "${DIR_MAILS}" ]; then
mkdir -p "${DIR_MAILS}";
if [ ! -d "${DOCS_DIR_MAILS}" ]; then
mkdir -p "${DOCS_DIR_MAILS}";
fi
mjml mjml/*.mjml -o "${DIR_MAILS}";
mjml mjml/*.mjml -o "${DOCS_DIR_MAILS}";
Loading