revivek / oy

Render HTML emails on the server with React.
MIT License
834 stars 47 forks source link

Allow customizing template without re-writing it #86

Closed berzniz closed 5 years ago

berzniz commented 5 years ago

I'm trying to send an email that is left aligned and have no paddings. Currently I have to create a custom template with these small change on lines 53 and 55.

https://github.com/revivek/oy/blob/b15803a975d3c7842ab54da50e72200e17a0acaf/src/utils/HTML4.js#L53-L57

Is there a better way to do it? I can submit a PR where there are more customization arguments if you think it's the best way to go.

revivek commented 5 years ago

It should be possible to have another table that’s left-aligned within the default table wrapper:

...
<td align=“center”>
  ...
  <Table width=“600”>
    <TR>
      <TD align=“left”>
      ...

I think that should work. Let me know if it doesn’t. I’m hesitant to grow the API of Oy.renderTemplate, but I’m not entirely opposed to this use-case if it’s a particularly useful default.

berzniz commented 5 years ago

I'll close this as I've made a custom template to deal with my requirement. I'm with you that keeping the API small is better.