dioxus icon indicating copy to clipboard operation
dioxus copied to clipboard

Dioxus fullstack empty project without tailwind depends on non-existent input.css

Open Silvea12 opened this issue 3 months ago • 4 comments

Problem

When creating a new dioxus fullstack project, the build will fail due to a missing input.css - something that is supplied with the tailwind css template. There is no reference to it in any files, and it's not a requirement of the web template.

Steps To Reproduce

Steps to reproduce the behavior:

  • dx new
  • template type: fullstack
  • css type: vanilla
  • add router: true
  • cd into your project
  • dx build or dx watch

Expected behavior

The build is successful - there is nothing depending on the input.css file at the project root.

** Resulting behavior **

ERROR manganis_cli_support::manifest: Failed to copy static asset: Failed to read file from location: /-snip-/dx-fullstack-test/input.css
Error: 🚫 Building project failed:

Caused by:
    0: Failed to read file from location: /-snip-/dx-fullstack-test/input.css
    1: No such file or directory (os error 2)

Screenshots

N/A

Environment:

  • Dioxus version: 0.5.0 release, dioxus git 9f280a8d84c183c74db3452d60a4601aa343813c (main at time of project creation)
  • Rust version: 1.77.1
  • OS info: Linux 6.8.2-zen1-1-zen #1 ZEN SMP PREEMPT_DYNAMIC x86_64 GNU/Linux
  • App platform: fullstack

Questionnaire

  • [x] I'm interested in fixing this myself but don't know where to start
  • [ ] I would like to fix and I have a solution
  • [ ] I don't have time to fix this right now, but maybe later

Silvea12 avatar Mar 30 '24 07:03 Silvea12

I encountered the same problem. I removed the ~/.cargo/assets path and it works.

Ameima avatar Mar 31 '24 04:03 Ameima

... Why in the world does dioxus write to ~/.cargo? Seems to fix it but why would it write there? That in of itself feels like a bug.

Silvea12 avatar Mar 31 '24 04:03 Silvea12

Ah, I've found it. As per https://github.com/DioxusLabs/collect-assets/blob/c585779eaf615900f1a76f332905988da3922573/common/src/cache.rs#L11-L14 it uses home::cargo_home() as a base - and this defaults to ~/.cargo if unspecified.

I'm not sure I'd consider this good behavior - I feel like it should make something in the project root directory instead.

Silvea12 avatar Mar 31 '24 04:03 Silvea12

You might be running into https://github.com/DioxusLabs/collect-assets/issues/14. If you used a css file in the past with manganis and removed it, there is a bug that will cause it to not be removed.

We use a global directory instead of a directory in the project so that assets for a library are bundled into any crates that rely on that library

ealmloff avatar Apr 06 '24 02:04 ealmloff