css_inline 0.10.3 → 0.10.5
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 +11 -10
- data/ext/css_inline/Cargo.toml +4 -4
- data/ext/css_inline/src/lib.rs +2 -2
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7c1ce0313176d3fbf3e29f259e5ef4299444ef22b996ac6e1b6023d2ad9cd03f
|
4
|
+
data.tar.gz: 90645b0df9444adbd108bf37c533d3d925081232061a516c771b43fe011c9160
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 28d78e1afe3d3d1e66c4d6e806b484a8af75f9fc0ab87c4cabf1857d66f121ad9430aa48ee4a6eaf1f8211f564c635bfdcc1b26f68835b4bab58fba746005245
|
7
|
+
data.tar.gz: caede1b4844d992c6a48f9912cb65c0fe874f7af05b00d1a54d89eae6e54885ec845142e2383bf1b3ca1e4e0d2f521eeeb5e6b7ce1915745adbd15e0899596a6
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# css_inline
|
2
2
|
|
3
|
-
[<img alt="build status" src="https://img.shields.io/github/actions/workflow/status/Stranger6667/css-inline/build.yml?style=flat-square&labelColor=555555&logo=github" height="20">](https://github.com/Stranger6667/css-inline)
|
3
|
+
[<img alt="build status" src="https://img.shields.io/github/actions/workflow/status/Stranger6667/css-inline/build.yml?style=flat-square&labelColor=555555&logo=github" height="20">](https://github.com/Stranger6667/css-inline/actions/workflows/build.yml)
|
4
4
|
[<img alt="ruby gems" src="https://img.shields.io/gem/v/css_inline?logo=ruby&style=flat-square" height="20">](https://rubygems.org/gems/css_inline)
|
5
5
|
[<img alt="codecov.io" src="https://img.shields.io/codecov/c/gh/Stranger6667/css-inline?logo=codecov&style=flat-square&token=tOzvV4kDY0" height="20">](https://app.codecov.io/github/Stranger6667/css-inline)
|
6
6
|
[<img alt="gitter" src="https://img.shields.io/gitter/room/Stranger6667/css-inline?style=flat-square" height="20">](https://gitter.im/Stranger6667/css-inline)
|
@@ -81,7 +81,7 @@ This results in faster execution times compared to employing parallel processing
|
|
81
81
|
|
82
82
|
For customization options use the `CSSInliner` class:
|
83
83
|
|
84
|
-
```
|
84
|
+
```ruby
|
85
85
|
require 'css_inline'
|
86
86
|
|
87
87
|
inliner = CSSInline::CSSInliner.new(keep_style_tags: true)
|
@@ -93,7 +93,7 @@ inliner.inline("...")
|
|
93
93
|
- `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`
|
94
94
|
- `load_remote_stylesheets`. Specifies whether remote stylesheets should be loaded. Default: `True`
|
95
95
|
- `extra_css`. Extra CSS to be inlined. Default: `nil`
|
96
|
-
- `preallocate_node_capacity`. **Advanced**. Preallocates capacity for HTML nodes during parsing. This can improve performance when you have an estimate of the number of nodes in your HTML document. Default: `
|
96
|
+
- `preallocate_node_capacity`. **Advanced**. Preallocates capacity for HTML nodes during parsing. This can improve performance when you have an estimate of the number of nodes in your HTML document. Default: `32`
|
97
97
|
|
98
98
|
You can also skip CSS inlining for an HTML tag by adding the `data-css-inline="ignore"` attribute to it:
|
99
99
|
|
@@ -132,18 +132,19 @@ inliner.inline("...")
|
|
132
132
|
## Performance
|
133
133
|
|
134
134
|
Leveraging efficient tools from Mozilla's Servo project, this library delivers superior performance.
|
135
|
-
It consistently outperforms `premailer`, offering speed increases often exceeding **
|
135
|
+
It consistently outperforms `premailer`, offering speed increases often exceeding **50 times**.
|
136
136
|
|
137
137
|
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
138
|
|
139
|
-
| | `css_inline 0.10.
|
140
|
-
|
141
|
-
| Basic usage |
|
142
|
-
| Realistic email 1 |
|
143
|
-
| Realistic email 2 |
|
139
|
+
| | Size | `css_inline 0.10.4` | `premailer 1.21.0 with Nokogiri 1.15.2` | Difference |
|
140
|
+
|-------------------|---------|---------------------|------------------------------------------------|------------|
|
141
|
+
| Basic usage | 230 B | 8.05 µs | 419.75 µs | **52.13x** |
|
142
|
+
| Realistic email 1 | 8.58 KB | 164.22 µs | 9.75 ms | **59.40x** |
|
143
|
+
| Realistic email 2 | 4.3 KB | 106.95 µs | Error: Cannot parse 0 calc((100% - 500px) / 2) | - |
|
144
|
+
| GitHub Page | 1.81 MB | 308.11 ms | 3.08 s | **9.99x** |
|
144
145
|
|
145
146
|
Please refer to the `test/bench.rb` file to review the benchmark code.
|
146
|
-
The results displayed above were measured using stable `rustc 1.
|
147
|
+
The results displayed above were measured using stable `rustc 1.71.1` on Ruby `3.2.2`.
|
147
148
|
|
148
149
|
## Ruby support
|
149
150
|
|
data/ext/css_inline/Cargo.toml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
[package]
|
2
2
|
name = "css-inline-ruby"
|
3
|
-
version = "0.10.
|
4
|
-
authors = ["Dmitry Dygalo <
|
3
|
+
version = "0.10.5"
|
4
|
+
authors = ["Dmitry Dygalo <dmitry@dygalo.dev>"]
|
5
5
|
edition = "2021"
|
6
6
|
readme = "README.rdoc"
|
7
7
|
description = "High-performance library for inlining CSS into HTML 'style' attributes"
|
@@ -9,14 +9,14 @@ 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.62.1"
|
13
13
|
|
14
14
|
[lib]
|
15
15
|
name = "css_inline"
|
16
16
|
crate-type = ["cdylib"]
|
17
17
|
|
18
18
|
[dependencies]
|
19
|
-
magnus = "0.
|
19
|
+
magnus = "0.6"
|
20
20
|
rayon = "1"
|
21
21
|
|
22
22
|
[dependencies.css-inline]
|
data/ext/css_inline/src/lib.rs
CHANGED
@@ -7,7 +7,7 @@
|
|
7
7
|
clippy::match_same_arms,
|
8
8
|
clippy::needless_borrow,
|
9
9
|
clippy::print_stdout,
|
10
|
-
clippy::
|
10
|
+
clippy::arithmetic_side_effects,
|
11
11
|
clippy::cast_possible_truncation,
|
12
12
|
clippy::unwrap_used,
|
13
13
|
clippy::map_unwrap_or,
|
@@ -72,7 +72,7 @@ fn parse_options<Req>(
|
|
72
72
|
base_url: parse_url(kwargs.2)?,
|
73
73
|
load_remote_stylesheets: kwargs.3.unwrap_or(true),
|
74
74
|
extra_css: kwargs.4.map(Cow::Owned),
|
75
|
-
preallocate_node_capacity: kwargs.5.unwrap_or(
|
75
|
+
preallocate_node_capacity: kwargs.5.unwrap_or(32),
|
76
76
|
})
|
77
77
|
}
|
78
78
|
|
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.10.
|
4
|
+
version: 0.10.5
|
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-08-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake-compiler
|
@@ -84,7 +84,7 @@ description: |2
|
|
84
84
|
`css_inline` inlines CSS into HTML documents, using components from Mozilla's Servo project.
|
85
85
|
This process is essential for sending HTML emails as you need to use "style" attributes instead of "style" tags.
|
86
86
|
email:
|
87
|
-
-
|
87
|
+
- dmitry@dygalo.dev
|
88
88
|
executables: []
|
89
89
|
extensions:
|
90
90
|
- ext/css_inline/extconf.rb
|
@@ -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.62.1
|
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
|