Skip to main content

Module plugins

Module 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§

accessibility
Accessibility utilities
background
Background utilities
border
Border utilities
css_property
Define a plugin used to generate CSS properties quickly.
effect
Effect utilities
filter
Filter utilities
flexbox
Flexbox utilities
grid
Grid utilities
interactivity
Interactivity utilities
layout
Layout utilities
sizing
Sizing utilities
spacing
Spacing utilities
svg
SVG utilities
table
Table utilities
transform
Transform utilities
transition
Transition and animation utilities
typography
Typography utilities

Structs§

Arbitrary
Define a plugin supporting arbitrary values, i.e all selectors in the form <namespace>-[...] (i.e the modifier is wrapped in square brackets).
ArbitraryDisambiguate
Define a CSS value type which is used to disambiguate the use of the arbitrary plugin.
Color
Define a plugin which supports all color modifiers, e.g red-200 (the list of colors is based on BUILTIN_COLORS and Theme::colors which is defined by the Config).
ExtraSlash
Add support for an extra slash (/) followed by a value for the utility classes handled by this plugin.
Functional
A powerful kind allowing the use a Rust function to handle all selectors in the form <namespace>-....
ListProperties
Define a plugin using a map between utility classes and raw CSS lines.
ListValues
Define a plugin using a map between utility classes and the values of a single CSS property.
Number
Define a plugin which supports any number as modifier.
Spacing
Define a plugin which supports all spacing modifiers, that is a (potentially floating) number, a fraction (e.g 3/4) or px.

Enums§

ArbitraryDisambiguateSeparation
When defining a [PluginArbitraryMatcher] for an Arbitrary kind, defines how values are separated.
Plugin
A plugin is a structure capable of generating CSS styles from a CSS selector.
PropertyName
Either a single or several CSS property names.

Type Aliases§

DynamicPlugin
An alias to a Plugin which contain configuration defined using Strings instead of static string references, likely deserialized from a configuration file.
DynamicPropertyName
An alias to a PropertyName which is defined using String, adapted for use when a name needs to be dynamic or deserialized.
StaticPlugin
An alias to a Plugin which can easily be defined in Rust, e.g in const environments.
StaticPropertyName
An alias to a PropertyName which is defined using &'static str, adapted for use in const environments.