-
-
Save halostatue/e73a92ebf73449916e4755ce295b470a to your computer and use it in GitHub Desktop.
turn mjml into html and txt.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Check if mjml is installed | |
if ! [ -x "$(command -v mjml)" ]; then | |
echo 'Error: mjml is not installed. Install with "npm install -g mjml"' >&2 | |
exit 1 | |
fi | |
# Check if html-to-text is installed | |
if ! [ -x "$(command -v html-to-text)" ]; then | |
echo 'Error: html-to-text is not installed. Install with "npm install -g html-to-text"' >&2 | |
exit 1 | |
fi | |
# Run command for all files passed as arguments to the script | |
for FILENAME in "$@" | |
do | |
echo Input: $FILENAME | |
FILENAME=${FILENAME%.*} | |
mjml -o $FILENAME.html $FILENAME.mjml | |
cat $FILENAME.html | html-to-text > $FILENAME.txt | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment