mjml-rb 0.2.6 → 0.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f213ff60765d24bebf6bd96742274aa2eed792452c0176b8de29bfbdbc8506cb
4
- data.tar.gz: 7859582b4ecf32f4f5018cbea4929169ebf96089fc3ae2c973672c015e190ed3
3
+ metadata.gz: b6cd1e0e7d201fa71910c7ecf5aa470f2053a948bae4b08f004bc44398f30155
4
+ data.tar.gz: 36a71f158c1ad304f53352e2b4657f2b2e253471edd4011b7e8270eca6895e73
5
5
  SHA512:
6
- metadata.gz: 28114bad8d00b9260fb49945b9383b18be09b588ba6474458d20b2b1b4f0986ca44cc8a20487e230931e4985e21f135878cbd938aff5f95fb156cd8af623558c
7
- data.tar.gz: 6992e280ea3c63a02b3715ffaf53e0944d123a1a17be5e3237fedc6a4a66baf44863ba14a822a1d931e0beddba8ded6d14d02271957b8afcdee4ab78df9dbda0
6
+ metadata.gz: 04bb951bdcebff861f813ee50fe54015510061a7ed83d3f563e5404eaa0128796450cf2b3bfa8943d4916b9fae4a33d2d33236b31be90156033f8be7c9074940
7
+ data.tar.gz: 312d94578cb0e649335e85cd73eaf8bcdd3ad93163cdda32917a572ebcff3dc1adee2d36f9956969b1eec959b89919708ac5aa6eaf1371bc500e5899e766ace2
data/README.md CHANGED
@@ -76,6 +76,4 @@ The table below tracks current JS-to-Ruby migration status for MJML components i
76
76
  | `mj-selector` | migrated | Supported as the selector container for `mj-html-attribute` rules. |
77
77
  | `mj-html-attribute` | migrated | Supported for injecting custom HTML attributes into matched rendered nodes. |
78
78
 
79
- Remaining top-level migration work is mainly `mj-carousel` and `mj-carousel-image`.
80
-
81
- TODO: `mj-html-attributes` currently uses `Nokogiri` to parse rendered HTML and apply CSS-selector-based attribute injections. Rewrite this path to avoid `Nokogiri` if we want to keep the runtime dependency surface minimal.
79
+ A more detailed parity backlog lives in [doc/TODO.md](/doc/TODO.md).
@@ -15,19 +15,19 @@ module MjmlRb
15
15
  "font-size" => "13px"
16
16
  }.freeze
17
17
 
18
- HEAD_STYLE = <<~CSS.freeze
19
- @media only screen and (max-width:480px) {
20
- table.mj-full-width-mobile { width: 100% !important; }
21
- td.mj-full-width-mobile { width: auto !important; }
22
- }
23
- CSS
24
-
25
18
  def tags
26
19
  TAGS
27
20
  end
28
21
 
29
- def head_style
30
- HEAD_STYLE
22
+ def head_style(breakpoint)
23
+ lower_breakpoint = make_lower_breakpoint(breakpoint)
24
+
25
+ <<~CSS
26
+ @media only screen and (max-width:#{lower_breakpoint}) {
27
+ table.mj-full-width-mobile { width: 100% !important; }
28
+ td.mj-full-width-mobile { width: auto !important; }
29
+ }
30
+ CSS
31
31
  end
32
32
 
33
33
  def head_style_tags
@@ -178,6 +178,13 @@ module MjmlRb
178
178
  else "0"
179
179
  end
180
180
  end
181
+
182
+ def make_lower_breakpoint(breakpoint)
183
+ matched = breakpoint.to_s.match(/[0-9]+/)
184
+ return breakpoint if matched.nil?
185
+
186
+ "#{matched[0].to_i - 1}px"
187
+ end
181
188
  end
182
189
  end
183
190
  end
@@ -1,3 +1,3 @@
1
1
  module MjmlRb
2
- VERSION = "0.2.6".freeze
2
+ VERSION = "0.2.8".freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mjml-rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ version: 0.2.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrei Andriichuk