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

Loading scripts and styles from files inside <script> and <link> #23

Open
YairLevi opened this issue Jan 7, 2024 · 0 comments
Open

Comments

@YairLevi
Copy link

YairLevi commented Jan 7, 2024

pretty straight forward. I have the following HTML:

<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        #root {
            max-width: 1280px;
            margin: 0 auto;
            padding: 2rem;
            text-align: center;
            background-color: #1f1f0f;
        }
    </style>
</head>
<body>
<div id="root">
    <p id="item"></p>
    <button>yes</button>
</div>
<script>
    document.getElementById("item").innerHTML = "generated content"
</script>
</body>
</html>

The output window is working as expected, showing the styles and the generated text inside the <p> tag.

however, if the script and styles were in files like this:

<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script type="module" src="index.js"></script>
    <link rel="stylesheet" href="styles.css">
</head>
<body>
<div id="root">
    <p id="item"></p>
    <button>yes</button>
</div>
</body>
</html>

Both the script and styles do not take effect. couldn't find a solution or anyone talking about it.
is there a solution? thanks in advance.

I am on windows 10, go 1.20

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

1 participant