snowfinch-macros

Crates.iosnowfinch-macros
lib.rssnowfinch-macros
version0.1.2
created_at2025-08-25 13:41:09.824193+00
updated_at2025-08-31 12:04:44.328866+00
descriptionA simple Rust proc-macro wrapper around tailwindcss.
homepage
repositoryhttps://github.com/callum-hopkins-dev/snowfinch
max_upload_size
id1809618
size19,954
Callum Hopkins (callum-hopkins-dev)

documentation

https://docs.rs/snowfinch

README

snowfinch

A simple Rust proc-macro wrapper around tailwindcss.

GitHub Actions Workflow Status Crates.io Version docs.rs Crates.io Total Downloads GitHub License

about

snowfinch is a very simple proc-macro wrapper around the fantastic tailwindcss framework. This crate aims to make it easy and ergonomic to quickly compile any utility classes into your project. A sha256 digest is also calculated and embedded with the stylesheet to aid with web content caching.

Note that this crate does not include the actual tailwindcss binary, as that would exceed the crates.io maximum of 10MB.

getting started

To start using snowfinch, you'll first need to add our package to your Cargo.toml manifest:

cargo add snowfinch

Then you can compile a stylesheet into a const; Refer to the official tailwindcss documentation for guidance on the stylesheet itself.

use snowfinch::Stylesheet;

// Here we use `tailwindcss` to compile a stylesheet called `tailwind.css`
// in the parent directory to this source file.
const STYLESHEET: Stylesheet<'static> = snowfinch::compile!("../tailwind.css");

fn main() {
  // Trick `tailwindcss` into generating a few utilities:
  // class="bg-slate-400 font-bold p-8"

  // Here we can get the generated stylesheet source, which should, among
  // other things contain the css for our utilities written above.
  let src = STYLESHEET.src();

  // We can also retrieve the sha256 digest of the stylesheet source, which
  // may be helpful for caching.
  let digest = STYLESHEET.digest();
}
Commit count: 15

cargo fmt