Skip to content

Commit

Permalink
Merge pull request #12 from Vinarnt/beautify_option
Browse files Browse the repository at this point in the history
Beautify option
  • Loading branch information
adrianrudnik authored Aug 23, 2021
2 parents 3617e73 + 3ee5049 commit 9b4ab8e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ ENV CORS=""
ENV MJML_KEEP_COMMENTS=false
ENV MJML_VALIDATION_LEVEL=soft
ENV MJML_MINIFY=true
ENV MJML_MINIFY=false

COPY package* ./

Expand Down
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ Due to various challenges this image sports the following features:
- Supports healthchecks.

# Table of contents
- [Overview](#overview)
- [Defaults](#defaults)
- [Development](#development)
- [Troubleshooting](#troubleshooting)
- [Overview](#overview)
- [Defaults](#defaults)
- [Development](#development)
- [Troubleshooting](#troubleshooting)

## Overview

Expand Down Expand Up @@ -45,6 +45,7 @@ services:
# - MJML_KEEP_COMMENTS=true
# - MJML_VALIDATION_LEVEL=strict
# - MJML_MINIFY=false
# - MJML_BEAUTIFY=true
```

## Defaults
Expand All @@ -56,6 +57,7 @@ CORS ""
MJML_KEEP_COMMENTS "false"
MJML_VALIDATION_LEVEL "soft"
MJML_MINIFY "true"
MJML_BEAUTIFY "false"
```

## Development
Expand All @@ -67,6 +69,7 @@ CORS "*"
MJML_KEEP_COMMENTS "true"
MJML_VALIDATION_LEVEL "strict"
MJML_MINIFY "false"
MJML_BEAUTIFY "true"
```

This will escalate any issues you have with invalid mjml code to the docker log (`stdout` or `docker-compose logs`).
Expand Down
2 changes: 2 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ app.use(bodyParser.text({
const opts = {
keepComments: (process.env.MJML_KEEP_COMMENTS === 'true'),
minify: (process.env.MJML_MINIFY === 'true'),
beautify: (process.env.MJML_BEAUTIFY === 'true'),
validationLevel: (['soft', 'strict', 'skip'].includes(process.env.MJML_VALIDATION_LEVEL) ? process.env.MJML_VALIDATION_LEVEL : 'soft'),
}

Expand Down Expand Up @@ -81,5 +82,6 @@ console.log('cors: ' + (process.env.CORS || 'n/a'))
console.log('mjml keep comments: ' + opts.keepComments)
console.log('mjml validation level: ' + opts.validationLevel)
console.log('mjml minify: ' + opts.minify)
console.log('mjml beautify: ' + opts.beautify)
console.log('')
console.log('POST mjml as text/plain raw body, result will be returned as text/html.')

0 comments on commit 9b4ab8e

Please sign in to comment.