tailwindcss-to-rust-macros 0.1.3

Helpers macros for using the Rust code generated by tailwindcss-to-rust
Documentation
  • Coverage
  • 77.78%
    7 out of 9 items documented0 out of 3 items with examples
  • Size
  • Source code size: 6.04 MB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 100.88 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • houseabsolute/tailwindcss-to-rust
    30 3 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • autarch

Helper macros for using the code generated by tailwindcss-to-rust.

The generated code provides a number of static structs where each field is a class name or modifier (like "lg" or "hover"). In typical use, you need to combine multiple names and modifiers into a single string to be set as an element's class attribute. This crate provides two macros to make using this a bit more ergonomic.

A Dioxus example:

// Note that you have to write this css module to tie it all together.
use css::*;
use dioxus_prelude::*;

fn SomeComponent(cx: Scope) -> Element {
    cx.render(rsx! {
        div {
            // "grid-cols-3 md:grid-cols-6 lg:grid-cols-12"
            class: DC![
                C::fg::grid-cols-3,
                M![M::md, C::fg::grid-cols-6],
                M![M::lg, C::fg::grid-cols-12]
            ],
            div {
                // "text-lg text-white"
                class: DC![C::typ::text_lg, C::typ::text_white],
            }
        }
    })
}