sighmon / mjml-rails

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

Made mjml_bin method aware of locally installed node_modules #2

Closed KittyGiraudel closed 8 years ago

KittyGiraudel commented 8 years ago

Hey there,

The mjml_bin method currently returns the output of which mjml command, which works fine when the module is globally installed but would fail to retrieve a binary when only installed locally.

This pull request intends to fix that by first checking the content of the node_modules folder in the current Rails project, then falling back on which if there is no local mjml.

One question though would be: do we have access to Rails in this file?

Ping @pgoetze.

KittyGiraudel commented 8 years ago

Damn, testes are failing. I will require your assistance here @sighmon. :)

sighmon commented 8 years ago

Hey @HugoGiraudel & @pgoetze, cool idea - we re-implemented it so that it locates the MJML executable and checks the version at require time to avoid crashing at runtime.

We also avoided using /usr/bin/which mjml in the hope it'll work on more operating systems (whispers Windows).

What do you think?