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

Script src not loading correctly in HTML head #2871

Closed
3 tasks
RustGrow opened this issue Aug 21, 2024 · 2 comments · Fixed by #2887
Closed
3 tasks

Script src not loading correctly in HTML head #2871

RustGrow opened this issue Aug 21, 2024 · 2 comments · Fixed by #2887
Assignees
Labels
bug Something isn't working html Related to the html crate
Milestone

Comments

@RustGrow
Copy link

When adding a script tag for the Tailwind CSS CDN in the head section of the HTML, the script is not loading correctly and the page appears empty.
The code being used to add the script tag is:

head::Script { src: asset!("https://cdn.tailwindcss.com") }
// or
head::Script { src: "https://cdn.tailwindcss.com" }

However, both of these approaches result in the script not being loaded

Expected Behavior:
The Tailwind CSS styles should be properly loaded and applied to the page when the script tag is added to the head section.

Actual Behavior:
Indicating the script is not being loaded correctly.

Steps to reproduce the behavior:

cargo install --git https://github.com/dioxuslabs/dioxus dioxus-cli --locked
dx --version
dioxus 0.6.0-alpha.2 (3c699aa)

[dependencies]
dioxus = { git = "https://github.com/DioxusLabs/dioxus", features = ["web", "router"] }
dioxus-logger = "0.5.1"

Screenshots
Screenshot (216)

Environment:

  • Dioxus version: 0.6.0-alpha.2 (3c699aa)
  • Rust version: rustc 1.80.1 (3f5fd8dd4 2024-08-06)
  • OS info: Windows 11 Pro, 23H2, 22631.4037
  • App platform: web

Questionnaire

  • 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
@ealmloff ealmloff changed the title Script not loading correctly in HTML head Script src not loading correctly in HTML head Aug 21, 2024
@ealmloff ealmloff added bug Something isn't working html Related to the html crate labels Aug 21, 2024
@ealmloff ealmloff added this to the 0.6.0 milestone Aug 21, 2024
@ealmloff ealmloff self-assigned this Aug 21, 2024
@jkelleyrtp
Copy link
Member

jkelleyrtp commented Aug 21, 2024

head::Link { href: "https://blah.css" } 

this will work today - it looks like we just don't do script properly.

@RustGrow
Copy link
Author

RustGrow commented Aug 21, 2024

Can you implement both types with a tag attribute and a body within it?
Example on https://tailwindcss.com/docs/installation/play-cdn
2 Try customizing your config

<script src="https://cdn.tailwindcss.com"></script>
  <script>
    tailwind.config = {
      theme: {
        extend: {
          colors: {
            clifford: '#da373d',
          }
        }
      }
    }
  </script>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working html Related to the html crate
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants