Skip to content

Commit

Permalink
#34 Fix processing of Haml/Slim layouts.
Browse files Browse the repository at this point in the history
  • Loading branch information
sighmon committed Aug 5, 2018
1 parent 98387e4 commit aa8a4d3
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 4.2.1

* Implemented Aleksandrs Ļedovskis' fix for Haml/Slim layouts.

## 4.2.0

* Aleksandrs Ļedovskis refactored MJML layout/template support to better match Rails standards.
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

**MJML-Rails** allows you to render HTML e-mails from an [MJML](https://mjml.io) template.

**Note:** If you’re using Haml/Slim layouts, please see [issue #34](https://github.com/sighmon/mjml-rails/issues/34) and weigh in on your opinion of how you’d like it solved.

An example template might look like:

```erb
Expand Down Expand Up @@ -79,6 +77,8 @@ Mjml.setup do |config|
end
```

**Note:** If you’re using Haml/Slim layouts, please don’t put `<mjml>` in comments in your partial. Read more: [#34](https://github.com/sighmon/mjml-rails/issues/34).

If you'd like to see render errors:

```ruby
Expand Down
2 changes: 1 addition & 1 deletion lib/mjml.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def call(template)
# by MJML library when top-level layout/template is rendered
#
# [0] - https://github.com/mjmlio/mjml/blob/master/doc/guide.md#mjml
if template.source =~ /<mjml>/
if compiled_source =~ /<mjml>/
"Mjml::Mjmltemplate.to_html(begin;#{compiled_source};end).html_safe"
else
compiled_source
Expand Down
2 changes: 1 addition & 1 deletion lib/mjml/version.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module Mjml
# Version number no longer matches MJML.io version
VERSION = "4.2.0"
VERSION = "4.2.1"
end

0 comments on commit aa8a4d3

Please sign in to comment.