DioxusLabs / dioxus

Fullstack app framework for web, desktop, mobile, and more.
https://dioxuslabs.com
Apache License 2.0
20.21k stars 774 forks source link

Script `src` not loading correctly in HTML head #2871

Closed DioxusGrow closed 2 weeks ago

DioxusGrow commented 3 weeks ago

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:

Questionnaire

jkelleyrtp commented 3 weeks ago
head::Link { href: "https://blah.css" } 

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

DioxusGrow commented 3 weeks ago

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>