Confused about variables
See original GitHub issueI’m sure this is a question that gets asked all the time, but I wanted to report my confusion about how MJML handles variables, if at all.
Looking at https://mjml.io/documentation/ I can’t see any technique to interpolate variables similar to Handlebars’ {{ foo }}
or JSX’ { bar }
.
On the other hand this post from just a few months ago mentions a {% set gender = var:user.gender %}
syntax
Is that deprecated? If so how do you do something a simple as showing a user’s name? (such as the “Hello, Helen” heading from the tutorial).
I feel like even if MJML doesn’t support variables anymore, the documentation should include a section about workarounds, because this is going to be one of the first questions anybody new to the library has.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:14
- Comments:9 (2 by maintainers)
Top Results From Across the Web
Confused about variables - calculus - Math Stack Exchange
Well, the underlying concept is simple. We take a certain point (x0,y0) lying on the given curve. At this point, slope of tangent...
Read more >A little confused on variables - Get Help - Codecademy Forums
Hi, I am on this lesson (https://www.codecademy.com/courses/introduction-to-javascript/lessons/variables/exercises/var It says on the hint ...
Read more >I'm really confused about variables and global variables - Reddit
First, a variable is just a word that holds a value. It saves that information for you to use later. For example, let's...
Read more >I think there's something I'm confused about with the variables
This for loop (the body of the loop) for (a; a > b; a++). is never executed because in the preceding code a...
Read more >How to think about instrumental variables when you get ...
How to think about instrumental variables when you get confused ... and so Piero did a more elaborate instrumental variables analysis using ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I get it now, but I think that explanation should be in the docs somewhere. I had assumed MJML was a replacement for Handlebars, where it’s actually more of a replacement for HTML; meaning you still need Handlebars or an equivalent to generate it.
Maybe it’s just me but that wasn’t obvious at all at first.
But it just makes a lot of sense to provide templating feature in-the-box. The whole project is designed for developer usage, so i think this is essential to have.
Not having template support just makes the whole process redundantly complicated.
Thoughts? 😃