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
encre-css-typography: used to define beautiful typographic defaults for HTML you don’t control.encre-css-icons: used to quickly add pure CSS icons to your website.
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). - Arbitrary
Disambiguate - 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 onBUILTIN_COLORSandTheme::colorswhich is defined by theConfig). - Extra
Slash - 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>-.... - List
Properties - Define a plugin using a map between utility classes and raw CSS lines.
- List
Values - 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) orpx.
Enums§
- Arbitrary
Disambiguate Separation - When defining a [
PluginArbitraryMatcher] for anArbitrarykind, defines how values are separated. - Plugin
- A plugin is a structure capable of generating CSS styles from a CSS selector.
- Property
Name - Either a single or several CSS property names.
Type Aliases§
- Dynamic
Plugin - An alias to a
Pluginwhich contain configuration defined usingStrings instead of static string references, likely deserialized from a configuration file. - Dynamic
Property Name - An alias to a
PropertyNamewhich is defined usingString, adapted for use when a name needs to be dynamic or deserialized. - Static
Plugin - An alias to a
Pluginwhich can easily be defined in Rust, e.g in const environments. - Static
Property Name - An alias to a
PropertyNamewhich is defined using&'static str, adapted for use in const environments.