question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Mjml-cli prints errors to a stdout, and they mix with rendered html code

See original GitHub issue

Mjml-cli currently prints warnings to a stdout, same as the rendered html template. This is a problem because when I compile templates like this mjml index.mjml > index.html, I don’t see any problems, and I risk accidentally sending an email that begins with mjml error messages.

Reproduction Steps:

Create a template with warning, for example by using a mj component in a scope where it doesn’t belong.

Expected behavior:

Errors are sent to stderr (console.error()) while the output appears on stdout (console.log()).

Observed behavior:

Both errors and output is sent to stdout, and errors appear at the beginning of compiled template.

MJML version:

4.1.2

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
tkafkacommented, Mar 6, 2019

I disagree with this - stdout should only be used for the actual output (so that you can redirect it to a file, and be sure you aren’t sending your users an email with validation messages).

All diagnostic output should go to stderr, and I propose to add setting to select verbosity (warnings and errors, or errors only).

1reaction
kmcb777commented, Sep 18, 2018

Hi @tkafka it’s true that errors could be sent to stderr, we’ll see for changing that in 4.3 Meanwhile, if you compile with mjml index.mjml -o index.html you have no risk to have errors in the output

Read more comments on GitHub >

github_iconTop Results From Across the Web

mjml-guides – Documentation for MJML - The Responsive ...
MJML Guides. MJML is a markup language designed to reduce the pain of coding a responsive email. Its semantic syntax makes it easy...
Read more >
mjml - npm
MJML is a markup language created by Mailjet and designed to reduce the pain of coding a responsive email. Its semantic syntax makes...
Read more >
How do I write standard error to a file while using "tee" with a ...
I'm assuming you want to still see standard error and standard output on the terminal. You could go for Josh Kelley's answer, but...
Read more >
Writing Error Messages to Standard Error Instead of Standard ...
First, let's observe how all content printed by minigrep is currently being written to standard output, including error messages that we want to...
Read more >
Standard output, standard error and command line redirection
If the user wants to see only the regular output, they can redirect the error channel to a file and examine it later,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found