diff --git a/src/mail/bin/html-to-plain-text b/src/mail/bin/html-to-plain-text index ced0c13d..68e2a350 100755 --- a/src/mail/bin/html-to-plain-text +++ b/src/mail/bin/html-to-plain-text @@ -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/; diff --git a/src/mail/bin/mjml-to-html b/src/mail/bin/mjml-to-html index fb5710b0..27db1a70 100755 --- a/src/mail/bin/mjml-to-html +++ b/src/mail/bin/mjml-to-html @@ -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}";