Skip to main content

StaticPropertyName

Type Alias StaticPropertyName 

Source
pub type StaticPropertyName = PropertyName<&'static str, &'static [&'static str]>;
Expand description

An alias to a PropertyName which is defined using &'static str, adapted for use in const environments.

Aliased Type§

pub enum StaticPropertyName {
    SingleProp(&'static str),
    MultipleProps(&'static [&'static str]),
}

Variants§

§

SingleProp(&'static str)

A single CSS property name.

§

MultipleProps(&'static [&'static str])

Several CSS property names in the order they will be generated.

The CSS value defined by the plugin will be copied to each of the properties.

§Example
use encre_css::{Config, generate};
use encre_css::prelude::build_plugin::*;

const PLUGIN: StaticPlugin = Plugin::Color(Color {
    namespace: "custom-decoration",
    prop: MultipleProps(&["-webkit-text-decoration-color", "text-decoration-color"]),
    ..Color::default()
});

let mut config = Config::default();
config.register_plugin(&PLUGIN);

let generated = generate(["custom-decoration-red-200"], &config);

assert!(generated.ends_with(r".custom-decoration-red-200 {
  -webkit-text-decoration-color: oklch(88.5% .062 18.334);
  text-decoration-color: oklch(88.5% .062 18.334);
}"));