css_inline 0.10.5 → 0.11.1
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 +4 -4
- data/README.md +6 -5
- data/ext/css_inline/Cargo.toml +2 -2
- data/ext/css_inline/src/lib.rs +9 -6
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fc02b5a44a61e246ee0e04baa7d9c897809e7bcb3777e8b8cf1987d40d12835e
|
4
|
+
data.tar.gz: 2f2bbd666aece18451648ba7404dcabffa7cc4ce5bbca67295281d0e0907032c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a2864e5df1bf930aa1f662acdfc3ce6e77e2c624cf858165fd2cfb37180e6a3123baad36acc57806652c1fe55de63e694ea520b6cf38eda3fd2bd2608361b1da
|
7
|
+
data.tar.gz: df08a979dbc4e4c033f4ec99b73e6d6cedb1e8ec6c172a224fa54287a67b6cbfec5f2448900719ff6fccc756dfaffbcfb32012147978c70151ee78f6a13e2757
|
data/README.md
CHANGED
@@ -88,6 +88,7 @@ inliner = CSSInline::CSSInliner.new(keep_style_tags: true)
|
|
88
88
|
inliner.inline("...")
|
89
89
|
```
|
90
90
|
|
91
|
+
- `inline_style_tags`. Specifies whether to inline CSS from "style" tags. Default: `True`
|
91
92
|
- `keep_style_tags`. Specifies whether to keep "style" tags after inlining. Default: `False`
|
92
93
|
- `keep_link_tags`. Specifies whether to keep "link" tags after inlining. Default: `False`
|
93
94
|
- `base_url`. The base URL used to resolve relative URLs. If you'd like to load stylesheets from your filesystem, use the `file://` scheme. Default: `nil`
|
@@ -136,15 +137,15 @@ It consistently outperforms `premailer`, offering speed increases often exceedin
|
|
136
137
|
|
137
138
|
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):
|
138
139
|
|
139
|
-
| | Size | `css_inline 0.
|
140
|
+
| | Size | `css_inline 0.11.1` | `premailer 1.21.0 with Nokogiri 1.15.2` | Difference |
|
140
141
|
|-------------------|---------|---------------------|------------------------------------------------|------------|
|
141
|
-
| Basic usage | 230 B | 8.
|
142
|
-
| Realistic email 1 | 8.58 KB |
|
143
|
-
| Realistic email 2 | 4.3 KB |
|
142
|
+
| Basic usage | 230 B | 8.23 µs | 415.18 µs | **50.93x** |
|
143
|
+
| Realistic email 1 | 8.58 KB | 162.69 µs | 10.12 ms | **62.21x** |
|
144
|
+
| Realistic email 2 | 4.3 KB | 116.01 µs | Error: Cannot parse 0 calc((100% - 500px) / 2) | - |
|
144
145
|
| GitHub Page | 1.81 MB | 308.11 ms | 3.08 s | **9.99x** |
|
145
146
|
|
146
147
|
Please refer to the `test/bench.rb` file to review the benchmark code.
|
147
|
-
The results displayed above were measured using stable `rustc 1.
|
148
|
+
The results displayed above were measured using stable `rustc 1.74.0` on Ruby `3.2.2`.
|
148
149
|
|
149
150
|
## Ruby support
|
150
151
|
|
data/ext/css_inline/Cargo.toml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
[package]
|
2
2
|
name = "css-inline-ruby"
|
3
|
-
version = "0.
|
3
|
+
version = "0.11.1"
|
4
4
|
authors = ["Dmitry Dygalo <dmitry@dygalo.dev>"]
|
5
5
|
edition = "2021"
|
6
6
|
readme = "README.rdoc"
|
@@ -9,7 +9,7 @@ repository = "https://github.com/Stranger6667/css-inline"
|
|
9
9
|
keywords = ["css", "html", "email", "stylesheet", "inlining"]
|
10
10
|
categories = ["web-programming"]
|
11
11
|
license = "MIT"
|
12
|
-
rust-version = "1.
|
12
|
+
rust-version = "1.65"
|
13
13
|
|
14
14
|
[lib]
|
15
15
|
name = "css_inline"
|
data/ext/css_inline/src/lib.rs
CHANGED
@@ -45,6 +45,7 @@ fn parse_options<Req>(
|
|
45
45
|
_,
|
46
46
|
(),
|
47
47
|
(
|
48
|
+
Option<bool>,
|
48
49
|
Option<bool>,
|
49
50
|
Option<bool>,
|
50
51
|
Option<String>,
|
@@ -57,6 +58,7 @@ fn parse_options<Req>(
|
|
57
58
|
args.keywords,
|
58
59
|
&[],
|
59
60
|
&[
|
61
|
+
"inline_style_tags",
|
60
62
|
"keep_style_tags",
|
61
63
|
"keep_link_tags",
|
62
64
|
"base_url",
|
@@ -67,12 +69,13 @@ fn parse_options<Req>(
|
|
67
69
|
)?;
|
68
70
|
let kwargs = kwargs.optional;
|
69
71
|
Ok(rust_inline::InlineOptions {
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
72
|
+
inline_style_tags: kwargs.0.unwrap_or(true),
|
73
|
+
keep_style_tags: kwargs.1.unwrap_or(false),
|
74
|
+
keep_link_tags: kwargs.2.unwrap_or(false),
|
75
|
+
base_url: parse_url(kwargs.3)?,
|
76
|
+
load_remote_stylesheets: kwargs.4.unwrap_or(true),
|
77
|
+
extra_css: kwargs.5.map(Cow::Owned),
|
78
|
+
preallocate_node_capacity: kwargs.6.unwrap_or(32),
|
76
79
|
})
|
77
80
|
}
|
78
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.
|
4
|
+
version: 0.11.1
|
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-
|
11
|
+
date: 2023-12-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake-compiler
|
@@ -123,8 +123,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: 3.3.26
|
125
125
|
requirements:
|
126
|
-
- Rust >= 1.
|
127
|
-
rubygems_version: 3.4.
|
126
|
+
- Rust >= 1.65
|
127
|
+
rubygems_version: 3.4.22
|
128
128
|
signing_key:
|
129
129
|
specification_version: 4
|
130
130
|
summary: High-performance library for inlining CSS into HTML 'style' attributes
|