sighmon / mjml-rails

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

'AbstractController::ActionNotFound' error with mj-font & Google font unescaped URL #78

Closed chasegiunta closed 3 years ago

chasegiunta commented 3 years ago

Pulling in multiple font weights the official way via Google Fonts url will throw an error:

AbstractController::ActionNotFound (Email 'css2' not found in [[[Mailer Preview Here]]]):

In order to pull in multiple font multiple font weights from Google, this is the tag used:

<mj-font name="Inter" href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" />

Looks like MJML is getting held up on the unescaped semicolons being used in the ?family param. Escaping those semicolons like so:

<mj-font name="Inter" href="https://fonts.googleapis.com/css2?family=Inter:wght@400%3B500%3B600%3B700&display=swap" />

... gets around the error. Not blocking me, but figured I'd flag it.

chasegiunta commented 3 years ago

This may ultimately be a premailer issue. If so, forgive me (ha) and feel free to close.

sighmon commented 3 years ago

@chasegiunta Sounds like it might be an MJML bug rather than a MJML-Rails bug, so see if you can replicate it here: https://mjml.io/try-it-live

If you can't, pop a sample .mjml file here and we can work on a fix.

chasegiunta commented 3 years ago

@sighmon Cannot reproduce on the live editor: https://mjml.io/try-it-live/BysLSV6sP

sighmon commented 3 years ago

@chasegiunta I tried your Google embed code in a example_mjml_rails app, and I can't replicate the bug sorry.

Screen Shot 2020-12-23 at 3 43 59 pm
chasegiunta commented 3 years ago

@sighmon never really got a chance to follow-up but if you want to close this, up to you.

We can probably either chalk this up to a dependency issue here, or something project-specific. Either way, the workaround works and this issue will serve as help for anyone who might possibly run into this in the future.