Module encre_css::plugins

source ·
Expand description

A Plugin is a handler used to convert utility classes into CSS declarations.

A lot of plugins are built in (like the ones from Tailwind CSS) and some others live in their own crates and need to be imported manually. They usually define a register function taking a mutable reference to a Config structure.

§Example (with encre-css-typography)

use encre_css::Config;

let mut config = Config::from_file("encre-css.toml")?;
// Or let mut config = Config::default();

encre_css_typography::register(&mut config);

let _css = encre_css::generate(
    [r#"<div class="prose prose-headings:text-blue-500 prose-slate lg:prose-lg dark:prose-invert"></div>"#],
    &config,
);
// Do something with the CSS

§Official plugins

If you want to write your own plugins, see Plugin.

Modules§

Traits§

  • A plugin is a structure capable of generating CSS styles from a modifier (contained in a context structure).