leptos-rs / cargo-leptos

Build tool for Leptos (Rust)
MIT License
314 stars 87 forks source link

Tailwind runs although it shouldn't #254

Closed NiklasEi closed 1 month ago

NiklasEi commented 3 months ago

To my understanding of the readme, Tailwind should only run if tailwind-input-file is set. I do not have it set, but Tailwind still runs during cargo leptos watch.

NiklasEi commented 3 months ago

This currently fails my build, because I have multiple scss modules that get combined by basro/stylance-rs and are not all valid without the other modules due to CSS variables.

nvim-ftw commented 2 months ago

Also having this issue.

nvim-ftw commented 2 months ago

Dug into some source code. Why is there tailwind stuff in the compile_sass function?

// ...
pub async fn compile_sass(style_file: &SourcedSiteFile, optimise: bool) -> Result<Outcome<String>> {
    let mut args = vec![style_file.source.as_str()];
    optimise.then(|| args.push("--no-source-map"));

    let exe = Exe::Sass.get().await.dot()?;

    let mut cmd = Command::new(exe);
    cmd.args(&args);

    log::trace!(
        "Style running {}",
        GRAY.paint(format!("sass {}", args.join(" ")))
    );

    match wait_piped_interruptible("Tailwind", cmd, Interrupt::subscribe_any()).await? {
        CommandResult::Success(output) => Ok(Outcome::Success(output.stdout())),
        CommandResult::Interrupted => Ok(Outcome::Stopped),
        CommandResult::Failure(output) => {
            log::warn!("Tailwind failed with:");
            println!("{}", output.stderr());
            Ok(Outcome::Failed)
        }
    }
}
benwis commented 2 months ago

To me that looks like someone copy pasted the tailwind one and forgot/didn't care to change the inner tailwind naming

On Sat, Mar 9, 2024, at 5:23 AM, Patrick Oberholzer wrote:

Dug into some source code. Why is there tailwind stuff in the compile_sass function?

// ... pub async fn compile_sass(style_file: &SourcedSiteFile, optimise: bool) -> Result<Outcome> { let mut args = vec![style_file.source.as_str()]; optimise.then(|| args.push("--no-source-map"));

let exe = Exe::Sass.get().await.dot()?;

let mut cmd = Command::new(exe);
cmd.args(&args);

log::trace!(
    "Style running {}",
    GRAY.paint(format!("sass {}", args.join(" ")))
);

match wait_piped_interruptible("Tailwind", cmd, Interrupt::subscribe_any()).await? {
    CommandResult::Success(output) => Ok(Outcome::Success(output.stdout())),
    CommandResult::Interrupted => Ok(Outcome::Stopped),
    CommandResult::Failure(output) => {
        log::warn!("Tailwind failed with:");
        println!("{}", output.stderr());
        Ok(Outcome::Failed)
    }
}

}

— Reply to this email directly, view it on GitHub https://github.com/leptos-rs/cargo-leptos/issues/254#issuecomment-1986856353, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABVBTCL3H2D52XAFRTF6V23YXMEONAVCNFSM6AAAAABDNRC6E2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOBWHA2TMMZVGM. You are receiving this because you are subscribed to this thread.Message ID: @.***>

nvim-ftw commented 2 months ago

@benwis Sounds likely to me. If I find the root of this issue and get around to opening a PR, I'll include a fix for that. It doesn't seem urgent, just problematic for debugging. @NiklasEi did you think Tailwind was failing because it said "Tailwind" (understandable) or did you confirm that? Might not be tailwind.

nvim-ftw commented 2 months ago

Also, I'll open a separate issue for whatever is going on right now with mine, since it seems not to be quite right for this issue.

NiklasEi commented 2 months ago

@benwis Sounds likely to me. If I find the root of this issue and get around to opening a PR, I'll include a fix for that. It doesn't seem urgent, just problematic for debugging. @NiklasEi did you think Tailwind was failing because it said "Tailwind" (understandable) or did you confirm that? Might not be tailwind.

I did not confirm it by looking into the code. It might not have been Tailwind in the end then, just Sass.

benwis commented 2 months ago

@nvim-ftw Would you like to open a quick PR to patch it to say Sass and not Tailwind, so more people are not confused?

nvim-ftw commented 2 months ago

@benwis I'll do it tonight!

On Thu, Mar 14, 2024 at 5:00 PM Ben Wishovich @.***> wrote:

@nvim-ftw https://github.com/nvim-ftw Would you like to open a quick PR to patch it to say Sass and not Tailwind, so more people are not confused?

— Reply to this email directly, view it on GitHub https://github.com/leptos-rs/cargo-leptos/issues/254#issuecomment-1998474773, or unsubscribe https://github.com/notifications/unsubscribe-auth/AVITPTKO4WGSWDRXC2HYVPLYYIFVHAVCNFSM6AAAAABDNRC6E2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOJYGQ3TINZXGM . You are receiving this because you were mentioned.Message ID: @.***>

NiklasEi commented 1 month ago

Resolved in #267