Skip to main content

DynamicPropertyName

Type Alias DynamicPropertyName 

Source
pub type DynamicPropertyName = PropertyName<String, Vec<String>>;
Expand description

An alias to a PropertyName which is defined using String, adapted for use when a name needs to be dynamic or deserialized.

Aliased Type§

pub enum DynamicPropertyName {
    SingleProp(String),
    MultipleProps(Vec<String>),
}

Variants§

§

SingleProp(String)

A single CSS property name.

§

MultipleProps(Vec<String>)

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);
}"));