voidlabs / mosaico

Mosaico - Responsive Email Template Editor
https://mosaico.io
GNU General Public License v3.0
1.71k stars 504 forks source link

Is it possible to update already saved templates in AWS S3 automatically #420

Closed sumitsijaria closed 6 years ago

sumitsijaria commented 6 years ago

Hi Team,

First of all I would like to thank you for great tool.

I have query regarding inheritance feature.

Suppose, I have done initial setup by coding in Mosaico to create predefined blocks and then use them to create templates, which I am saving in AWS S3.

Now my question is, when I do update in code for existing blocks, I want to propagate those changes in all templates saved in AWS S3 which are using that particular block.

I know automatic binding works when we pull saved templates into editor and Editor notify us that code for used block has changed. However I am trying possibility to skip this step and do template update automatically.

Please let me know if its possible or not. If yes, please suggest how.

Thanks in advance

bago commented 6 years ago

I don't really get the scenario.

Are you asking for a way to programmatically generate the output HTML from the JSON of a "saved email"?

sumitsijaria commented 6 years ago

Yes, Let me explain

First I created my predefined blocks and then created templates. After that I saved templates in S3.

We have customized the Mosaico and added Manage template feature.

All saved templates will be listed in table with edit button.

Now again I changed block level changes by code. Now when I pull my saved template in editor, I see reflected changes.

If I save template, it will be saved to S3.

My question is, I want to bypass opening template in editor and then save manually. I want to automate this.

How to achieve it.

bago commented 6 years ago

It should be possible. Share your fork if you expect free help. If you are using a commercial license then ask to your mosaico support contact.

sumitsijaria commented 6 years ago

Thank you. We are using commercial licence. BTW any hint? :)

sumitsijaria commented 6 years ago

@bago I checked following methods are executing in order before landing to editor.html.

  1. translateTemplate
  2. generateModel
  3. generateEditors
  4. initializeViewModel
  5. applyBindings Once applyBindings run, i want to save template automatically whose hash value i had passed.Also i want to run in loop to do same with all templates on single button click, that is update all.
bago commented 6 years ago

I'm sorry this is out of scope for the library in the opensource context (we don't feel many people will share this requirement so we can't put effort on this, now). If you contacted the commercial support you'll get an answer there.

I would be happy to answer if this was something easy, but it would take a while to dig in the code and try to understand what can be done and how.