css_inline 0.12.0 → 0.13.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ecc6091cab3a8511eb3e5135f0028488cb11eebcdcc64efaababbe404a154aff
4
- data.tar.gz: e0c4874267b3455c13f04321a56c5ff526b903acdc517adafdb4a73731598339
3
+ metadata.gz: 341c8140008fc97311b7c05e23becedbfde8a2bb212cab1602f4fcf4b12d90aa
4
+ data.tar.gz: cbcb902ad4446aac95f369258cced29a9729fd19772f001e1faa1dd72641d324
5
5
  SHA512:
6
- metadata.gz: 6c9d1fd5e9c7a81680e19ff417bdc57f815b22399887cf84441d4f03bf6ccd6ce7f96da6555054fddecc9a396de22f76a2e0705f3b3f030db6863994f5a3e8b3
7
- data.tar.gz: c16c50735d1f2dc40691a1c74f9688147818a0d78005549df819044ad6beb0fc11339feb2faf7148c69f78b3dd44108e9cfd604a6904d4ec8953df5ead5f6049
6
+ metadata.gz: c6ea53abccd62a28badf56f9298f54307fbff3609a46e6d79bdbf7e5a65171b92ae5d38363e426cda70e1e932117d983c6a302735d41fc82ad40ffb84948f15b
7
+ data.tar.gz: 7ada5bffbc4961928a6fe48e70e8bb3f73419cd86bc46315bca86ae55efb3c04ec046888b4eb9c98f4a20f80158d5d9387f28cf25fc20a916dea54c7e83c04e9
data/README.md CHANGED
@@ -40,6 +40,7 @@ into:
40
40
  - Can process multiple documents in parallel
41
41
  - Works on Linux, Windows, and macOS
42
42
  - Supports HTML5 & CSS3
43
+ - Tested on Ruby 2.7 and 3.2.
43
44
 
44
45
  ## Playground
45
46
 
@@ -124,6 +125,21 @@ The `data-css-inline="ignore"` attribute also allows you to skip `link` and `sty
124
125
  </body>
125
126
  ```
126
127
 
128
+ Alternatively, you may keep `style` from being removed by using the `data-css-inline="keep"` attribute.
129
+ This is useful if you want to keep `@media` queries for responsive emails in separate `style` tags:
130
+
131
+ ```html
132
+ <head>
133
+ <!-- Styles below are not removed -->
134
+ <style data-css-inline="keep">h1 { color:blue; }</style>
135
+ </head>
136
+ <body>
137
+ <h1>Big Text</h1>
138
+ </body>
139
+ ```
140
+
141
+ Such tags will be kept in the resulting HTML even if the `keep_style_tags` option is set to `false`.
142
+
127
143
  If you'd like to load stylesheets from your filesystem, use the `file://` scheme:
128
144
 
129
145
  ```ruby
@@ -141,19 +157,15 @@ It consistently outperforms `premailer`, offering speed increases often exceedin
141
157
 
142
158
  The table below provides a detailed comparison between `css_inline` and `premailer` when inlining CSS into an HTML document (like in the Usage section above):
143
159
 
144
- | | Size | `css_inline 0.11.2` | `premailer 1.21.0 with Nokogiri 1.15.2` | Difference |
160
+ | | Size | `css_inline 0.13.0` | `premailer 1.21.0 with Nokogiri 1.15.2` | Difference |
145
161
  |-------------------|---------|---------------------|------------------------------------------------|------------|
146
- | Basic usage | 230 B | 8.27 µs | 433.55 µs | **52.35x** |
147
- | Realistic email 1 | 8.58 KB | 159.20 µs | 9.88 ms | **62.10x** |
148
- | Realistic email 2 | 4.3 KB | 103.41 µs | Error: Cannot parse 0 calc((100% - 500px) / 2) | - |
149
- | GitHub Page | 1.81 MB | 301.66 ms | 3.08 s | **10.24x** |
162
+ | Basic usage | 230 B | 7.79 µs | 417.56 µs | **53.57x** |
163
+ | Realistic email 1 | 8.58 KB | 149.56 µs | 9.73 ms | **65.07x** |
164
+ | Realistic email 2 | 4.3 KB | 93.19 µs | Error: Cannot parse 0 calc((100% - 500px) / 2) | - |
165
+ | GitHub Page | 1.81 MB | 237.03 ms | 3.02 s | **12.78x** |
150
166
 
151
167
  Please refer to the `test/bench.rb` file to review the benchmark code.
152
- The results displayed above were measured using stable `rustc 1.74.1` on Ruby `3.2.2`.
153
-
154
- ## Ruby support
155
-
156
- `css_inline` supports Ruby 2.7 and 3.2.
168
+ The results displayed above were measured using stable `rustc 1.75.0` on Ruby `3.2.2`.
157
169
 
158
170
  ## Further reading
159
171
 
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "css-inline-ruby"
3
- version = "0.12.0"
3
+ version = "0.13.0"
4
4
  authors = ["Dmitry Dygalo <dmitry@dygalo.dev>"]
5
5
  edition = "2021"
6
6
  readme = "README.rdoc"
@@ -25,7 +25,6 @@
25
25
  rust_2018_compatibility,
26
26
  rust_2021_compatibility
27
27
  )]
28
- #[allow(clippy::module_name_repetitions)]
29
28
  use css_inline as rust_inline;
30
29
  use magnus::{
31
30
  class, define_module, function, method,
@@ -34,7 +33,7 @@ use magnus::{
34
33
  RHash, Value,
35
34
  };
36
35
  use rayon::prelude::*;
37
- use std::borrow::Cow;
36
+ use std::{borrow::Cow, sync::Arc};
38
37
 
39
38
  type RubyResult<T> = Result<T, magnus::Error>;
40
39
 
@@ -76,6 +75,7 @@ fn parse_options<Req>(
76
75
  load_remote_stylesheets: kwargs.4.unwrap_or(true),
77
76
  extra_css: kwargs.5.map(Cow::Owned),
78
77
  preallocate_node_capacity: kwargs.6.unwrap_or(32),
78
+ resolver: Arc::new(rust_inline::DefaultStylesheetResolver),
79
79
  })
80
80
  }
81
81
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: css_inline
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.0
4
+ version: 0.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitry Dygalo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-12-28 00:00:00.000000000 Z
11
+ date: 2024-01-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake-compiler
@@ -124,7 +124,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
124
124
  version: 3.3.26
125
125
  requirements:
126
126
  - Rust >= 1.65
127
- rubygems_version: 3.4.10
127
+ rubygems_version: 3.4.19
128
128
  signing_key:
129
129
  specification_version: 4
130
130
  summary: High-performance library for inlining CSS into HTML 'style' attributes