-
Notifications
You must be signed in to change notification settings - Fork 115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tailwind v4 support #428
base: main
Are you sure you want to change the base?
Tailwind v4 support #428
Conversation
target_arch: &str, | ||
version: Option<&str>, | ||
) -> Result<String>; | ||
fn executable_name(&self, target_os: &str, target_arch: &str, version: &str) -> Result<String>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made version
a &str
instead of an Option<&str>
since the only place the function is called, the version is guarunteed to be known. It also doesn't seem like this function will be called in a different place.
@@ -331,6 +331,8 @@ impl Command for CommandTailwind { | |||
|
|||
/// Tool binary download url for the given OS and platform arch | |||
fn download_url(&self, target_os: &str, target_arch: &str, version: &str) -> Result<String> { | |||
let use_musl = is_linux_musl_env() && version.starts_with("v4"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if I should put in the effort to make the Tailwind version check more robust. I doubt they'll be coming out with a new major version any time soon.
Here: cargo-leptos/src/config/tailwind.rs Lines 14 to 28 in b2136f1
Please mark it as a draft pr and not ready for review just to communicate that this is still work in progress and not ready to review. |
How are you planning on telling Tailwind to scan .rs files without a tailwind config file? |
My apologies. I accidentally opened it as ready for review and was unable to find out how to revert it to a draft PR after the fact.
According to the Tailwind CSS docs, almost every type of file gets scanned:
If the rust files still get ignored, we can still add sources explicity wiith |
Good to know, I have not read their new docs |
From what I can tell, the JS config file is autogenerated in I could use the environment variable to tell what the version is, although that will break if the env var isn't specified and the user is using the default version. Alternatively, since the Edit: Another idea occurred to me. Users could specify which version of Tailwind they want to use in the Cargo.toml compilation/site parameters. This could take precedence over the default version hardcoded in this codebase, but be overrideable the environment variable. Yet another approach could be scanning a package.json file, if present, for the version it uses. |
Closes #426 and closes #417.
Judging by the linked issues, I'm not the only one interested in using Tailwind v4 with Leptos. I added code to support use on linux musl, though I'm not sure how to test that it's correct. I also haven't figured out how to prevent the generation of a JS config file (which isn't needed in Tailwind v4) when using v4. Because of all of this, I'm opening this PR as a draft.