perseus-tailwind

Crates.ioperseus-tailwind
lib.rsperseus-tailwind
version0.5.0
sourcesrc
created_at2022-11-19 14:43:24.278846
updated_at2023-09-01 10:23:45.720237
descriptionA plugin for Perseus that automatically builds Tailwind CSS
homepage
repositoryhttps://github.com/wingertge/perseus-tailwind
max_upload_size
id718506
size12,045
Genna Wingert (wingertge)

documentation

README

Perseus Tailwind Plugin

This is a simple plugin for Perseus that runs the Tailwind CLI at build time. It will automatically download the newest version of the CLI initialize the project to look for class names in Rust files in src and HTML files in static. Further configuration can be done as usual in tailwind.config.js.

Usage

Add the plugin to you Perseus App in your Perseus main function.

PerseusApp::new()
    .plugins(Plugins::new().plugin(
        perseus_tailwind::get_tailwind_plugin,
        perseus_tailwind::TailwindOptions {
            in_file: "src/tailwind.css".into(),
            // Don't put this in /static, it will trigger build loops.
            // Put this in /dist and use a static alias instead.
            out_file: "dist/tailwind.css".into(),
        },
    ))
    .static_alias("/tailwind.css", "dist/tailwind.css")

If you're already using plugins just add the plugin to your Plugins as usual.

Versioning

Major and minor versions will follow the Perseus version for simplicity. This means 0.4 of this plugin will work with Perseus 0.4.x, 0.5 would work with a future 0.5 version of Perseus, etc.

Using a custom binary

If you for some reason want to use a specific version of the CLI or some other CLI with the same command line interface entirely, just place the binary with its default system-specific name (i.e. tailwindcss-linux-arm64) in the project directory.

Stability

The plugin is fairly simple and shouldn't break anything since it just executes the Tailwind CLI. The download and installation should work on Linux, macOS and Windows on all architectures that are supported by Tailwind, but is currently only tested on Windows x64.

Commit count: 34

cargo fmt