css_inline 0.24.0 → 0.25.0
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 +4 -1
- data/ext/css_inline/Cargo.lock +5 -5
- data/ext/css_inline/Cargo.toml +2 -2
- data/src/lib.rs +15 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c4e01ba7b32825f524ebea632f191fead2e634a870435606632b6f5397d07c98
|
|
4
|
+
data.tar.gz: 4ea255343e0fc9ece7ce88e8b23b1ca7a94385ee689cf498d73ecf4ea1db21fb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 48d57f08f5a27aecfec67e50c33095c13234cec05aac5f9f040818057a102b12a292b5a644ed76a474d7f46d3dfb54108a1610fc4fc334d9ae828b3c919bf0fa
|
|
7
|
+
data.tar.gz: cfb46ddc6b9615d4835054ec06b13cd7cc5cc80384d438b52be1fd8deb9b03f44a3158e65227e8fc3cd29c8f3055c6909d77521cf9f9b82c700e5cb710d8980d
|
data/README.md
CHANGED
|
@@ -150,7 +150,7 @@ The module functions accept the same keyword arguments, for example `CSSInline.i
|
|
|
150
150
|
- `inline_style_tags`. Inline CSS from `style` tags. Default: `true`
|
|
151
151
|
- `keep_style_tags`. Keep `style` tags after inlining. Default: `false`
|
|
152
152
|
- `keep_link_tags`. Keep `link` tags after inlining. Default: `false`
|
|
153
|
-
- `keep_at_rules`. Keep at-rules (starting with `@`) after inlining. Default: `false`
|
|
153
|
+
- `keep_at_rules`. Keep at-rules (starting with `@`) after inlining. Errors in fragment inlining. Default: `false`
|
|
154
154
|
- `minify_css`. Remove trailing semicolons and spaces between properties and values. Default: `false`
|
|
155
155
|
- `base_url`. Base URL for resolving relative URLs. Use the `file://` scheme to load stylesheets from the filesystem. Default: `nil`
|
|
156
156
|
- `load_remote_stylesheets`. Load stylesheets from `link` tags, over the network or from `file://` paths. Default: `true`
|
|
@@ -161,6 +161,9 @@ The module functions accept the same keyword arguments, for example `CSSInline.i
|
|
|
161
161
|
- `apply_width_attributes`. Add `width` HTML attributes from CSS `width` properties on `table`, `td`, `th` and `img`. Default: `false`
|
|
162
162
|
- `apply_height_attributes`. Add `height` HTML attributes from CSS `height` properties on `table`, `td`, `th` and `img`. Default: `false`
|
|
163
163
|
- `resolve_css_variables`. Replace `var()` references with the values of the custom properties they refer to and drop the `--*` declarations. Default: `false`
|
|
164
|
+
- `media_type`. Inline rules from `@media` blocks whose query lists this media type or `all`, e.g. `@media print` or `@media screen, print` for `print`. Queries with media features, such as `print and (min-width: 600px)`, never apply. An inlined block is not kept as an at-rule. Ignored when `keep_at_rules` is enabled and `inline_style_tags` is disabled. Default: `nil`
|
|
165
|
+
- `keep_classes`. Keep `class` attributes in the output. When disabled, class selectors in kept `<style>` blocks and at-rules match nothing. Default: `true`
|
|
166
|
+
- `remove_unused_at_rules`. Remove rules that match no element from kept at-rules (`@media`, `@supports`, ...), along with blocks left empty. Needs `keep_at_rules` or `remove_inlined_selectors`. Matching ignores `:hover`, `::before` and similar. This also removes rules that target markup injected by an email client (e.g. Gmail's `u ~ div .x`). Default: `false`
|
|
164
167
|
|
|
165
168
|
To skip CSS inlining for an HTML tag, add the `data-css-inline="ignore"` attribute to it:
|
|
166
169
|
|
data/ext/css_inline/Cargo.lock
CHANGED
|
@@ -160,9 +160,9 @@ checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28"
|
|
|
160
160
|
|
|
161
161
|
[[package]]
|
|
162
162
|
name = "css-inline"
|
|
163
|
-
version = "0.
|
|
163
|
+
version = "0.25.0"
|
|
164
164
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
165
|
-
checksum = "
|
|
165
|
+
checksum = "d6e74c3b82760bba679830a24c099276d77873f55095e2dc047be13cf188546c"
|
|
166
166
|
dependencies = [
|
|
167
167
|
"cssparser",
|
|
168
168
|
"hashbrown",
|
|
@@ -181,7 +181,7 @@ dependencies = [
|
|
|
181
181
|
|
|
182
182
|
[[package]]
|
|
183
183
|
name = "css-inline-ruby"
|
|
184
|
-
version = "0.
|
|
184
|
+
version = "0.25.0"
|
|
185
185
|
dependencies = [
|
|
186
186
|
"css-inline",
|
|
187
187
|
"magnus",
|
|
@@ -1216,9 +1216,9 @@ dependencies = [
|
|
|
1216
1216
|
|
|
1217
1217
|
[[package]]
|
|
1218
1218
|
name = "selectors"
|
|
1219
|
-
version = "0.
|
|
1219
|
+
version = "0.43.0"
|
|
1220
1220
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1221
|
-
checksum = "
|
|
1221
|
+
checksum = "474a2075f58859e8482495e1a2ae9634754ee383ad09a3c4093b8d9a51910fa3"
|
|
1222
1222
|
dependencies = [
|
|
1223
1223
|
"bitflags",
|
|
1224
1224
|
"cssparser",
|
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.25.0"
|
|
4
4
|
authors = ["Dmitry Dygalo <dmitry@dygalo.dev>"]
|
|
5
5
|
edition = "2024"
|
|
6
6
|
readme = "README.rdoc"
|
|
@@ -21,7 +21,7 @@ magnus = "0.9"
|
|
|
21
21
|
rayon = "1"
|
|
22
22
|
|
|
23
23
|
[dependencies.css-inline]
|
|
24
|
-
version = "0.
|
|
24
|
+
version = "0.25.0"
|
|
25
25
|
default-features = false
|
|
26
26
|
features = ["http", "file", "stylesheet-cache"]
|
|
27
27
|
|
data/src/lib.rs
CHANGED
|
@@ -76,6 +76,12 @@ struct Options {
|
|
|
76
76
|
/// Substitute `var()` references with the values of the custom properties they refer to
|
|
77
77
|
/// and drop the `--*` declarations from the inlined styles.
|
|
78
78
|
resolve_css_variables: Option<bool>,
|
|
79
|
+
/// Inline rules from `@media` blocks that apply to this media type.
|
|
80
|
+
media_type: Option<String>,
|
|
81
|
+
/// Keep `class` attributes in the output.
|
|
82
|
+
keep_classes: Option<bool>,
|
|
83
|
+
/// Remove rules that match no element from the conditional at-rules (`@media`, `@supports`, ...) kept in the output.
|
|
84
|
+
remove_unused_at_rules: Option<bool>,
|
|
79
85
|
}
|
|
80
86
|
|
|
81
87
|
impl TryConvert for Options {
|
|
@@ -103,6 +109,10 @@ impl TryConvert for Options {
|
|
|
103
109
|
.aref::<_, Option<bool>>(ruby.to_symbol("apply_height_attributes"))?,
|
|
104
110
|
resolve_css_variables: h
|
|
105
111
|
.aref::<_, Option<bool>>(ruby.to_symbol("resolve_css_variables"))?,
|
|
112
|
+
media_type: h.aref::<_, Option<String>>(ruby.to_symbol("media_type"))?,
|
|
113
|
+
keep_classes: h.aref::<_, Option<bool>>(ruby.to_symbol("keep_classes"))?,
|
|
114
|
+
remove_unused_at_rules: h
|
|
115
|
+
.aref::<_, Option<bool>>(ruby.to_symbol("remove_unused_at_rules"))?,
|
|
106
116
|
})
|
|
107
117
|
}
|
|
108
118
|
}
|
|
@@ -129,6 +139,9 @@ fn parse_options<Req>(
|
|
|
129
139
|
apply_width_attributes: kwargs.apply_width_attributes.unwrap_or(false),
|
|
130
140
|
apply_height_attributes: kwargs.apply_height_attributes.unwrap_or(false),
|
|
131
141
|
resolve_css_variables: kwargs.resolve_css_variables.unwrap_or(false),
|
|
142
|
+
media_type: kwargs.media_type,
|
|
143
|
+
keep_classes: kwargs.keep_classes.unwrap_or(true),
|
|
144
|
+
remove_unused_at_rules: kwargs.remove_unused_at_rules.unwrap_or(false),
|
|
132
145
|
})
|
|
133
146
|
}
|
|
134
147
|
|
|
@@ -176,7 +189,8 @@ impl From<InlineErrorWrapper> for magnus::Error {
|
|
|
176
189
|
rust_inline::InlineError::ParseError(message) => {
|
|
177
190
|
magnus::Error::new(ruby.exception_arg_error(), message.to_string())
|
|
178
191
|
}
|
|
179
|
-
rust_inline::InlineError::MissingStyleSheet { .. }
|
|
192
|
+
rust_inline::InlineError::MissingStyleSheet { .. }
|
|
193
|
+
| rust_inline::InlineError::UnsupportedFragmentOption => {
|
|
180
194
|
magnus::Error::new(ruby.exception_arg_error(), error.0.to_string())
|
|
181
195
|
}
|
|
182
196
|
}
|
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.25.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: 2026-11-
|
|
11
|
+
date: 2026-11-17 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rb_sys
|