Skip to content

Commit ea099db

Browse files
committed
docs: Misc updates
1 parent f3098bf commit ea099db

File tree

7 files changed

+61
-61
lines changed

7 files changed

+61
-61
lines changed

README.md

Lines changed: 22 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,13 @@ into:
3737
</html>
3838
```
3939

40+
- Uses reliable components from Mozilla's Servo
41+
- Inlines CSS from `style` and `link` tags
42+
- Removes `style` and `link` tags
43+
- Resolves external stylesheets (including local files)
44+
- Works on Linux, Windows, and macOS
45+
- Supports HTML5 & CSS3
46+
4047
## Installation
4148

4249
To include it in your project, add the following line to the dependencies section in your project's `Cargo.toml` file:
@@ -68,7 +75,7 @@ fn main() -> Result<(), css_inline::InlineError> {
6875
}
6976
```
7077

71-
### Features & Configuration
78+
### Configuration
7279

7380
`css-inline` can be configured by using `CSSInliner::options()` that implements the Builder pattern:
7481

@@ -148,44 +155,27 @@ We provide bindings for Python and WebAssembly. Check the `bindings` directory f
148155

149156
## Command Line Interface
150157

151-
`css-inline` provides a command-line interface:
152-
153-
```text
154-
css-inline --help
155-
156-
css-inline inlines CSS into HTML documents.
157-
158-
USAGE:
159-
css-inline [OPTIONS] [PATH ...]
160-
command | css-inline [OPTIONS]
158+
### Installation
161159

162-
ARGS:
163-
<PATH>...
164-
An HTML document to process. In each specified document
165-
"css-inline" will look for all relevant "style" and "link"
166-
tags, will load CSS from them and then inline it to the
167-
HTML tags, according to the corresponding CSS selectors.
168-
When multiple documents are specified, they will be
169-
processed in parallel, and each inlined file will be saved
170-
with an "inlined." prefix. For example, for "example.html",
171-
there will be "inlined.example.html".
160+
Install with `cargo`:
172161

173-
OPTIONS:
162+
```
163+
cargo install css-inline
164+
```
174165

175-
--keep-style-tags
176-
Keep "style" tags after inlining.
166+
### Usage
177167

178-
--base-url
179-
The base URL used to resolve relative URLs.
168+
The following command inlines CSS in multiple documents in parallel. Resulting files will be saved
169+
as `inlined.email1.html` and `inlined.email2.html`:
180170

181-
--load-remote-stylesheets
182-
Specifies if remote stylesheets should be loaded or not.
171+
```
172+
css-inline email1.html email2.html
173+
```
183174

184-
--extra-css
185-
Additional CSS to inline.
175+
For full details of the options available, you can use the `--help` flag:
186176

187-
--output-filename-prefix
188-
Custom prefix for output files. Defaults to `inlined.`.
177+
```
178+
css-inline --help
189179
```
190180

191181
## Extra materials

bindings/python/README.md

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,18 @@ into:
3838
</html>
3939
```
4040

41-
- 10-350x faster than existing CSS inliners;
42-
- Removing `style` tags after inlining;
43-
- Resolving external stylesheets (including local files);
44-
- Out-of-document CSS to inline;
45-
- Inlining multiple documents in parallel (via Rust-level threads)
41+
- Uses reliable components from Mozilla's Servo
42+
- 10-300x faster than alternatives
43+
- Inlines CSS from `style` and `link` tags
44+
- Removes `style` and `link` tags
45+
- Resolves external stylesheets (including local files)
46+
- Can process multiple documents in parallel
47+
- Works on Linux, Windows, and macOS
48+
- Supports HTML5 & CSS3
4649

4750
## Installation
4851

49-
To install `css_inline` via `pip` run the following command:
52+
Install with `pip`:
5053

5154
```
5255
pip install css_inline
@@ -57,8 +60,6 @@ a Rust compiler to build this package from source. The minimum supported Rust ve
5760

5861
## Usage
5962

60-
To inline CSS in an HTML document:
61-
6263
```python
6364
import css_inline
6465

@@ -96,7 +97,9 @@ css_inline.inline_many(["<...>", "<...>"])
9697

9798
`inline_many` will spawn threads on the Rust level; thus, you can expect it's running faster than `css_inline.inline` via Python's `multiprocessing` or `threading` modules.
9899

99-
For customization options use the `CSSInliner` class:
100+
### Configuration
101+
102+
For configuration options use the `CSSInliner` class:
100103

101104
```python
102105
import css_inline

bindings/python/pyproject.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@ known_third_party = []
1313

1414
[project]
1515
name = "css-inline"
16-
description = "Fast CSS inlining written in Rust"
16+
description = "High-performance library for inlining CSS into HTML 'style' attributes"
17+
keywords = ["css", "html", "email", "stylesheet", "inlining"]
1718
authors = [
18-
{name = "Dmitry Dygalo", email = "[email protected]"}
19+
{ name = "Dmitry Dygalo", email = "[email protected]" }
1920
]
2021
license = { text = "MIT" }
2122
classifiers=[

bindings/wasm/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ version = "0.9.0"
44
authors = ["Dmitry Dygalo <[email protected]>"]
55
edition = "2021"
66
readme = "README.md"
7-
description = "A WASM package for inlining CSS into HTML documents"
7+
description = "High-performance library for inlining CSS into HTML 'style' attributes"
88
repository = "https://github.com/Stranger6667/css-inline"
9-
keywords = ["html", "css", "css-inline"]
9+
keywords = ["css", "html", "email", "stylesheet", "inlining"]
1010
categories = ["web-programming"]
1111
license = "MIT"
1212
rust-version = "1.60"

bindings/wasm/README.md

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,20 @@ into:
3636
</html>
3737
```
3838

39-
- Removing ``style`` tags after inlining;
40-
- Out-of-document CSS to inline;
39+
- Uses reliable components from Mozilla's Servo
40+
- Inlines CSS from `style` and `link` tags
41+
- Removes `style` and `link` tags
42+
- Resolves external stylesheets (including local files)
43+
- Works on Linux, Windows, and macOS
44+
- Supports HTML5 & CSS3
45+
46+
## Install
47+
48+
Install with `npm`:
49+
50+
```
51+
npm install --save css-inline
52+
```
4153

4254
## Usage
4355

@@ -56,21 +68,12 @@ var inlined = inline(
5668
</body>
5769
</html>
5870
`,
59-
{ keep_style_tags: true }
6071
)
61-
// Inlined HTML looks like this:
62-
// <html>
63-
// <head>
64-
// <title>Test</title>
65-
// <style>h1 { color:red; }</style>
66-
// </head>
67-
// <body>
68-
// <h1 style="color:red;">Test</h1>
69-
// </body>
70-
// </html>
7172
// Do something with the inlined HTML, e.g. send an email
7273
```
7374

75+
### Configuration
76+
7477
- `keep_style_tags`. Specifies whether to keep "style" tags after inlining. Default: `false`
7578
- `keep_link_tags`. Specifies whether to keep "link" tags after inlining. Default: `false`
7679
- `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`

css-inline/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ authors = ["Dmitry Dygalo <[email protected]>"]
55
edition = "2021"
66
license = "MIT"
77
readme = "../README.md"
8-
description = "A crate for inlining CSS into 'style' HTML attributes."
8+
description = "High-performance library for inlining CSS into HTML 'style' attributes"
99
repository = "https://github.com/Stranger6667/css-inline"
10-
keywords = ["html", "css", "css-inline", "email"]
10+
keywords = ["css", "html", "email", "stylesheet", "inlining"]
1111
exclude = [".github", ".pre-commit-config.yaml", ".yamllint", ".gitignore", "tests"]
1212
categories = ["web-programming"]
1313
rust-version = "1.60"

css-inline/src/main.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
2626
r#"
2727
Dmitry Dygalo <[email protected]>
2828
29-
css-inline inlines CSS into HTML documents.
29+
css-inline inlines CSS into HTML 'style' attributes.
3030
3131
USAGE:
3232
css-inline [OPTIONS] [PATH ...]
@@ -46,6 +46,9 @@ OPTIONS:
4646
--keep-style-tags
4747
Keep "style" tags after inlining.
4848
49+
--keep-link-tags
50+
Keep "link" tags after inlining.
51+
4952
--base-url
5053
Used for loading external stylesheets via relative URLs.
5154

0 commit comments

Comments
 (0)