As I understand right now, this package supports only 3 MJML backends: cmd, tcpserver, and httpserver. Also, there is no way to extend this list because all variants are hardcoded.
https://github.com/liminspace/django-mjml/blob/master/mjml/tools.py#L156
I think it would be very nice to have a custom option to pass any path to some callable. This way, anyone can build their backend if needed.
For example:
# settings.py
MJML_BACKEND_MODE = 'myproject.mjml.backends.custom_renderer'
# myproject.mjml.backends.py
def custom_renderer(mjml):
return requests.get('http://mjml-server.cluster.local', json={'mjml': mjml}).json()['html']
Now rendering part can be easily delegated anywhere we want.
I can create pull request, but I think I will need some help with testing 😄
As I understand right now, this package supports only 3 MJML backends: cmd, tcpserver, and httpserver. Also, there is no way to extend this list because all variants are hardcoded.
https://github.com/liminspace/django-mjml/blob/master/mjml/tools.py#L156
I think it would be very nice to have a custom option to pass any path to some callable. This way, anyone can build their backend if needed.
For example:
Now rendering part can be easily delegated anywhere we want.
I can create pull request, but I think I will need some help with testing 😄