You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-`inline_style_tags`. Specifies whether to inline CSS from "style" tags. Default: `true`
127
127
-`keep_style_tags`. Specifies whether to keep "style" tags after inlining. Default: `false`
128
128
-`keep_link_tags`. Specifies whether to keep "link" tags after inlining. Default: `false`
129
+
-`keep_at_rules`. Specifies whether to keep "at-rules" (starting with `@`) after inlining. Default: `false`
129
130
-`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: `None`
130
131
-`load_remote_stylesheets`. Specifies whether remote stylesheets should be loaded. Default: `true`
131
132
-`cache`. Specifies cache for external stylesheets. Default: `None`
@@ -157,7 +158,8 @@ The `data-css-inline="ignore"` attribute also allows you to skip `link` and `sty
157
158
```
158
159
159
160
Alternatively, you may keep `style` from being removed by using the `data-css-inline="keep"` attribute.
160
-
This is useful if you want to keep `@media` queries for responsive emails in separate `style` tags:
161
+
This is useful if you want to keep `@media` queries for responsive emails in separate `style` tags.
162
+
Such tags will be kept in the resulting HTML even if the `keep_style_tags` option is set to `false`.
161
163
162
164
```html
163
165
<head>
@@ -169,7 +171,20 @@ This is useful if you want to keep `@media` queries for responsive emails in sep
169
171
</body>
170
172
```
171
173
172
-
Such tags will be kept in the resulting HTML even if the `keep_style_tags` option is set to `false`.
174
+
Another possibility is to set `keep_at_rules` option to `true`. At-rules cannot be inlined into HTML therefore they
175
+
get removed by default. This is useful if you want to keep at-rules, e.g. `@media` queries for responsive emails in
176
+
separate `style` tags but inline any styles which can be inlined.
177
+
Such tags will be kept in the resulting HTML even if the `keep_style_tags` option is explicitly set to `false`.
178
+
179
+
```html
180
+
<head>
181
+
<!-- With keep_at_rules=true "color:blue" will get inlined into <h1> but @media will be kept in <style> -->
Copy file name to clipboardExpand all lines: bindings/c/README.md
+17-2Lines changed: 17 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -153,6 +153,7 @@ Possible configurations:
153
153
- `inline_style_tags`. Specifies whether to inline CSS from "style" tags. Default: `true`
154
154
- `keep_style_tags`. Specifies whether to keep "style" tags after inlining. Default: `false`
155
155
- `keep_link_tags`. Specifies whether to keep "link" tags after inlining. Default: `false`
156
+
- `keep_at_rules`. Specifies whether to keep "at-rules" (starting with `@`) after inlining. Default: `false`
156
157
- `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: `NULL`
157
158
- `load_remote_stylesheets`. Specifies whether remote stylesheets should be loaded. Default: `true`
158
159
- `cache`. Specifies caching options for external stylesheets. Default: `NULL`
@@ -186,7 +187,8 @@ The `data-css-inline="ignore"` attribute also allows you to skip `link` and `sty
186
187
```
187
188
188
189
Alternatively, you may keep `style` from being removed by using the `data-css-inline="keep"` attribute.
189
-
This is useful if you want to keep `@media` queries for responsive emails in separate `style` tags:
190
+
This is useful if you want to keep `@media` queries for responsive emails in separate `style` tags.
191
+
Such tags will be kept in the resulting HTML even if the `keep_style_tags` option is set to `false`.
190
192
191
193
```html
192
194
<head>
@@ -198,7 +200,20 @@ This is useful if you want to keep `@media` queries for responsive emails in sep
198
200
</body>
199
201
```
200
202
201
-
Such tags will be kept in the resulting HTML even if the `keep_style_tags` option is set to `false`.
203
+
Another possibility is to set `keep_at_rules` option to `true`. At-rules cannot be inlined into HTML therefore they
204
+
get removed by default. This is useful if you want to keep at-rules, e.g. `@media` queries for responsive emails in
205
+
separate `style` tags but inline any styles which can be inlined.
206
+
Such tags will be kept in the resulting HTML even if the `keep_style_tags` option is explicitly set to `false`.
207
+
208
+
```html
209
+
<head>
210
+
<!-- With keep_at_rules=true "color:blue" will get inlined into <h1> but @media will be kept in <style> -->
0 commit comments