"]
edition = "2018"
[dependencies]
-mrml = "5.1"
+mrml = { version = "6.0.1", features = ["css-inline"] }
magnus = "0.8"
[dependencies.serde]
diff --git a/ext/mrml/src/lib.rs b/ext/mrml/src/lib.rs
index bdd063b..2112866 100644
--- a/ext/mrml/src/lib.rs
+++ b/ext/mrml/src/lib.rs
@@ -72,7 +72,7 @@ impl Template {
impl Clone for Template {
fn clone(&self) -> Self {
- Self::new(self.to_mjml()).unwrap()
+ Self { res: self.res.clone() }
}
}
diff --git a/test/fixtures/inline.mjml b/test/fixtures/inline.mjml
new file mode 100644
index 0000000..19a8e24
--- /dev/null
+++ b/test/fixtures/inline.mjml
@@ -0,0 +1,18 @@
+
+
+
+ .highlight { color: #F45E43; }
+
+
+ .footer { color: #888888; }
+
+
+
+
+
+ Hello World
+ Goodbye World
+
+
+
+
diff --git a/test/mrml_test.rb b/test/mrml_test.rb
index 59b77e8..ecebfe6 100644
--- a/test/mrml_test.rb
+++ b/test/mrml_test.rb
@@ -35,6 +35,34 @@ def test_that_it_generates_html
assert_match 'Hello World', result
end
+ def test_that_it_inlines_styles
+ result = ::MRML.to_html(inline_template)
+
+ assert_match %r{| ]*style="[^"]*color: ?#F45E43}, result
+ refute_match %r{ |