tailwindcss-native-rust-macro

Crates.iotailwindcss-native-rust-macro
lib.rstailwindcss-native-rust-macro
version0.1.0
sourcesrc
created_at2024-04-22 00:46:28.532347
updated_at2024-04-22 00:46:28.532347
descriptionGenerate tailwind output as a literal string at compile time.
homepage
repositoryhttps://github.com/llblumire/tailwindcss-native-rust-macro
max_upload_size
id1215744
size28,883
Lucille Blumire (LLBlumire)

documentation

https://docs.rs/tailwindcss-native-rust-macro

README

The include_tailwind! macro expects to be passed a set of arguments that will govern how it behaves. The expected format is as follows:

include_tailwind! {
    config: "path/to/tailwind.config.js",
    input: "path/to/tailwind.input.js",
    tailwindcss_bin: "/path/to/tailwindcss/bin/tailwindcss"
}

If a relative path is given, it will be taken relative to the CARGO_MANIFEST_DIR.

The macro will then compile to an inline string representing the output from tailwindcss. This can then be embeded in and returned by (with necessary CSS headers) your web server framework of choice.

If any of the arguments are not present, they will be read from a corresponding environment variable:

  • TAILWINDCSS_CONFIG
  • TAILWINDCSS_INPUT
  • TAILWINDCSS_BIN

If you would like to override the environment variable being read from, you may do that with the _env parameters.

include_tailwind! {
    config_env: "MY_TAILWINDCSS_CONFIG_ENV_VAR",
    input_env: "MY_TAILWINDCSS_INPUT_ENV_VAR",
    tailwindcss_bin: "MY_TAILWINDCSS_BIN_ENV_VAR"
}
Commit count: 3

cargo fmt