css_inline 0.24.0-aarch64-linux → 0.25.0-aarch64-linux

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: 4e2ea21c44e392e65a40dae3129f9f0dd666b3a153401566447020d6075c27af
4
- data.tar.gz: 717210270155973780e963df80129e22ccd2898dcdcb36d9984ebc1b049ebdd9
3
+ metadata.gz: dfd509d527e3aeab665005942d28612ad82c2df0539757b9ed22097f7c5939a8
4
+ data.tar.gz: e83b80be2e3bcdf4a60fd8484f1595402ad5b4e054ef6a5c3027a01293d71ff3
5
5
  SHA512:
6
- metadata.gz: a7d9a4a62f885954e2b07bb90bb00403ca09f09b8db0ea3c5fe1a1af57b6c55f511fc555c56e93d96e0e75ed1d0f4eee9e46b85c7e5c3556289fe7e391119d6a
7
- data.tar.gz: bd91cb82b3b325052f63995c1ae0bd2abbec60e1719bb84d8f3316ed5691daf5330404071c6021bd6b20f3d75e407fd21ffb4951ed1921fecae4b910cb201ddc
6
+ metadata.gz: 9f8e1ed958c5692a8b796a5d1ac13465aba038b5b42e1bcb8c976f5c58cd04186b5b5bd98694138d9a46b2a37a421eb43eb02c50077be59b067b9921b44a4049
7
+ data.tar.gz: 19c02aa6a0785c112a274ba357506e4f16f4aefcd2012f665ec9cb72edfb58176f4536d9efd41cb30bbe7fd26b3f90fac99a3bac0f6855aa03752778f64b2a18
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
 
Binary file
Binary file
Binary file
Binary file
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.24.0
4
+ version: 0.25.0
5
5
  platform: aarch64-linux
6
6
  authors:
7
7
  - Dmitry Dygalo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-11-12 00:00:00.000000000 Z
11
+ date: 2026-11-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake-compiler