css-inline
A crate for inlining CSS into HTML documents. When you send HTML emails, you need to use "style" attributes instead of "style" tags.
For example, this HTML:
Test
Big Text
Will be turned into this:
Test
Big Text
To use it in your project add the following line to your dependencies
section in the project's Cargo.toml
file:
= "0.6"
Usage
use css_inline;
const HTML: &str = r#"<html>
<head>
<title>Test</title>
<style>h1 { color:blue; }</style>
</head>
<body>
<h1>Big Text</h1>
</body>
</html>"#;
Features & Configuration
css-inline
can be configured by using CSSInliner::options()
that implements the Builder pattern:
use css_inline;
inline_style_tags
. Whether to inline CSS from "style" tags. Default:true
remove_style_tags
. Remove "style" tags after inlining. Default:false
base_url
. Base URL to resolve relative URLs. Default:None
load_remote_stylesheets
. Whether remote stylesheets should be loaded or not. Default:true
extra_css
. Additional CSS to inline. Default:None
Command Line Interface
css-inline
provides a command-line interface:
|
<PATH>...
Support
If you have anything to discuss regarding this library, please, join our gitter!