buildTrunkPackage: add support for tailwindcss 4#990
Merged
ipetkov merged 6 commits intoipetkov:masterfrom Mar 24, 2026
Merged
Conversation
ipetkov
reviewed
Mar 16, 2026
88b7fc6 to
2a13f1e
Compare
Trunk supports generating css with [tailwind](https://tailwindcss.com) for assets using `rel="tailwind-css"` in the index.html file (see [trunk documentation](https://trunk-rs.github.io/trunk/guide/assets/index.html#tailwind)). Output of the tailwind CLI used to extract the version number (there is noflag to get the version, using the `--help` flag instead): ``` phil@m1ir:~/ > nix-shell -p tailwindcss_4 [nix-shell:~]$ tailwindcss --help ≈ tailwindcss v4.1.18 Usage: tailwindcss [--input input.css] [--output output.css] [--watch] [options…] [...] ``` The env variable `TRUNK_TOOLS_TAILWIND` expects to have the version number without the leading `v`. Callers must provide the tailwind CLI with `nativeBuildInputs`.
2a13f1e to
358368f
Compare
Contributor
Author
|
Sorry, I forgot to fix the tests when I made the changes a couple of days ago. Tests are fixed, and rebased from master. |
Instead of re-vendoring and recompiling deps, we can just patch the necessary changes and only rebuild the top level crate
Owner
|
Thanks for the contribution! I tweaked the tests a bit to simplify things (and reduce how much we need to recompile) but otherwise looks good to me! |
Contributor
Author
|
My pleasure! Nice trick to patch the example to get tailwind, didn't thought of that! Cheers |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Trunk supports generating css with tailwind for assets using
rel="tailwind-css"in the index.html file (see trunk documentation).Output of the tailwind CLI used to extract the version number (there is noflag to get the version, using the
--helpflag instead):The env variable
TRUNK_TOOLS_TAILWINDexpects to have the version number without the leadingv.Motivation
I use trunk with tailwind, and it's my first time packaging a trunk app with crane. I had to add the env variables in my derivation, and saw afterwards the support for SCSS and wanted to give back upstream! Thank you for this library.
Checklist
docs/API.md(or general documentation) with changesCHANGELOG.mdFor the test I duplicated the existing test
trunk, removed the scss file and added tailwind, let me know if I did something wrong.