Skip to main content

TailwindConfig

Struct TailwindConfig 

Source
pub struct TailwindConfig {
Show 13 fields pub enabled: bool, pub preflight: bool, pub dark_mode: TailwindDarkMode, pub theme: BTreeMap<String, String>, pub utilities: BTreeMap<String, TailwindUtility>, pub variants: BTreeMap<String, String>, pub plugins: Vec<String>, pub safelist: Vec<String>, pub sources: Vec<PathBuf>, pub stylesheets: Vec<PathBuf>, pub css: String, pub minify_classes: bool, pub keep_classes: Vec<String>,
}
Expand description

[tailwind]: Tailwind CSS generated from the classes used in the app.

[tailwind]
enabled = true
dark_mode = "class"
plugins = ["@tailwindcss/typography"]

[tailwind.theme]                 # becomes @theme { --color-brand: …; }
color-brand = "#f26b2a"
font-display = "Inter, sans-serif"

[tailwind.utilities]             # becomes @utility …
btn = "rounded-lg bg-brand px-4 py-2 font-semibold text-white"
content-auto = { content-visibility = "auto" }

[tailwind.variants]              # becomes @custom-variant …
theme-midnight = "&:where([data-theme=midnight] *)"

Fields§

§enabled: bool

Generate Tailwind CSS for the app. Off unless set.

§preflight: bool

Include Tailwind’s base styles (Preflight).

§dark_mode: TailwindDarkMode

When dark: applies.

§theme: BTreeMap<String, String>

Theme variables, with or without the leading --: color-brand = "#f26b2a", breakpoint-3xl = "120rem".

§utilities: BTreeMap<String, TailwindUtility>

Custom utility classes: a list of Tailwind classes to combine, or CSS declarations.

§variants: BTreeMap<String, String>

Custom variants: name → selector (&:where(…)) or at-rule.

§plugins: Vec<String>

First-party plugins bundled with Tailwind, e.g. @tailwindcss/typography and @tailwindcss/forms.

§safelist: Vec<String>

Classes to generate even if they don’t appear in the source.

§sources: Vec<PathBuf>

Extra directories to scan for classes, besides the app directory and src/.

§stylesheets: Vec<PathBuf>

CSS files compiled with the app’s classes, in order, after the options above and before css. Each file is a full Tailwind input: @theme, @layer, @utility, @apply, @custom-variant and @keyframes all work. Paths are relative to the config file. Only the listed files are watched for changes, so list a file instead of @importing it.

§css: String

Raw CSS appended after everything else (@keyframes, @layer, …), for what the options above can’t express.

§minify_classes: bool

Release builds rename every Tailwind class to a short random name (rounded-lg → k7) in the CSS and the HTML. Development builds always keep the names you wrote.

§keep_classes: Vec<String>

Classes that keep their names in release builds, for code outside the view tree that refers to them (a script in a Rust string, HTML from an external service).

Trait Implementations§

Source§

impl Clone for TailwindConfig

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TailwindConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for TailwindConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for TailwindConfig

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for TailwindConfig

Source§

impl PartialEq for TailwindConfig

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for TailwindConfig

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for TailwindConfig

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.