css_inline 0.17.0 → 0.18.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/Cargo.lock +277 -362
- data/README.md +14 -0
- data/ext/css_inline/Cargo.lock +277 -362
- data/ext/css_inline/Cargo.toml +5 -5
- data/ext/css_inline/src/lib.rs +77 -55
- metadata +3 -3
data/README.md
CHANGED
|
@@ -136,6 +136,7 @@ inliner.inline("...")
|
|
|
136
136
|
- `keep_style_tags`. Specifies whether to keep "style" tags after inlining. Default: `false`
|
|
137
137
|
- `keep_link_tags`. Specifies whether to keep "link" tags after inlining. Default: `false`
|
|
138
138
|
- `keep_at_rules`. Specifies whether to keep "at-rules" (starting with `@`) after inlining. Default: `false`
|
|
139
|
+
- `minify_css`. Specifies whether to remove trailing semicolons and spaces between properties and values. Default: `false`
|
|
139
140
|
- `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`
|
|
140
141
|
- `load_remote_stylesheets`. Specifies whether remote stylesheets should be loaded. Default: `true`
|
|
141
142
|
- `cache`. Specifies caching options for external stylesheets (for example, `StylesheetCache(size: 5)`). Default: `nil`
|
|
@@ -195,6 +196,19 @@ Such tags will be kept in the resulting HTML even if the `keep_style_tags` optio
|
|
|
195
196
|
</body>
|
|
196
197
|
```
|
|
197
198
|
|
|
199
|
+
If you set the the `minify_css` option to `true`, the inlined styles will be minified by removing trailing semicolons
|
|
200
|
+
and spaces between properties and values.
|
|
201
|
+
|
|
202
|
+
```html
|
|
203
|
+
<head>
|
|
204
|
+
<!-- With minify_css=true, the <h1> will have `style="color:blue;font-weight:bold"` -->
|
|
205
|
+
<style>h1 { color: blue; font-weight: bold; }</style>
|
|
206
|
+
</head>
|
|
207
|
+
<body>
|
|
208
|
+
<h1>Big Text</h1>
|
|
209
|
+
</body>
|
|
210
|
+
```
|
|
211
|
+
|
|
198
212
|
If you'd like to load stylesheets from your filesystem, use the `file://` scheme:
|
|
199
213
|
|
|
200
214
|
```ruby
|