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
Usage
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:
const HTML: &str = r#"<html>
<head>
<title>Test</title>
<style>h1 { color:blue; }</style>
</head>
<body>
<h1>Big Text</h1>
</body>
</html>"#;
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