sighmon / mjml-rails

MJML + ERb/Haml/Slim view template
https://mjml.io
Other
295 stars 64 forks source link

Simplify Handler class and extract to own file #74

Closed doits closed 3 years ago

doits commented 3 years ago

While working on it I saw this indirection to Mjml::Mjmltemplate. Looks like the parser can be simply called by Mjml::Handler directly which makes it simpler. Or is there any special need for this indirection?

In addition it extracts the Handler to an own file and I simplified the regex a little bit to be non greedy, so it does not match/parse then whole template anymore, which might be a little bit faster (not tested though).

sighmon commented 3 years ago

@doits Sorry it took me so long to get to this - I think the Mjml::Mjmltemplate was something inherited from the original project I forked it from, so I don't know of its significance.

Let's try your solution and see how it goes. It looks fine in my projects, and I agree the regex update speeds things up too.