Skip to content
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

dioxus-cli, web example, no CSS #3261

Closed
kuba23c opened this issue Nov 29, 2024 · 4 comments
Closed

dioxus-cli, web example, no CSS #3261

kuba23c opened this issue Nov 29, 2024 · 4 comments

Comments

@kuba23c
Copy link

kuba23c commented Nov 29, 2024

Problem

I created example web app with dioxus-cli with vanilla css.
I followed this doc: https://dioxuslabs.com/learn/0.5/getting_started
Web app builds properly but there is no CSS on website.

Steps To Reproduce

Steps to reproduce the behavior:

  • cargo install dioxus-cli
  • dx new (Web, Vanilla css, Dioxus router, name: test)
  • cd test
  • dx serve

Expected behavior

CSS format website properly

Screenshots

image

Environment:

  • Dioxus version: v0.5.7
  • Rust version: stable-x86_64-pc-windows-msvc , rustc 1.82.0 (f6e511eec 2024-10-15)
  • OS info: windows
  • App platform: web

Questionnaire

@vjackson725
Copy link

Oh!

I was just about to post an issue on this. Something seems to be broken with CSS + dioxus in general.

This problem also happens on fullstack, and isn't specific to the test application.

Changing the style field (e.g. style = ["/assets/main.css"] or style = ["./assets/main.css"]) in Dioxus.toml does not fix this either.

@johnny-smitherson
Copy link

johnny-smitherson commented Dec 2, 2024

I have also met with this problem.

The main branch build of dioxus-cli seems to fix this:

  • run cargo install --git https://github.com/DioxusLabs/dioxus dioxus-cli
  • run again dx new -- creates another template with dioxus 0.6.0-alpha.5
  • edit style = ["assets/main.css"]

... but it only fixes this for web, not for desktop

@kuba23c
Copy link
Author

kuba23c commented Dec 19, 2024

After release v0.6.1 web example and CSS works properly:

cargo binstall dioxus-cli --version 0.6.1 --force

@ealmloff
Copy link
Member

The assets in the template work on web and desktop. The template imports assets using the document::* element which work across all platforms.

edit `style = ["assets/main.css"]`
... but it only fixes this for web, not for desktop

The web.resource.style field in the Dioxus.toml is only used in the web build. The new document::Link element works across all platforms

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants