Skip to content
This repository has been archived by the owner on Jun 29, 2023. It is now read-only.

Persistent changes to index.html? #106

Closed
serzhiio opened this issue Feb 23, 2023 · 1 comment
Closed

Persistent changes to index.html? #106

serzhiio opened this issue Feb 23, 2023 · 1 comment

Comments

@serzhiio
Copy link

Lets say i want to add some classes and styles to html, body and div[id=main] tags, but if i change ./assets/index.html it will be rewritten after next run of dioxus serve command. So how to make persistent changes?

@ealmloff
Copy link
Member

If you create a html file in the root of your project the dioxus cli will use it. We need to document this feature and probably insert the init script by default in the future

<!DOCTYPE html>
<html>

<head>
</head>

<body>
    <div id="main">
    </div>
    <!-- this is currently needed, but should probably be inserted by default in the future -->
    <script type="module">
        import init from "/{base_path}/assets/dioxus/{app_name}.js";
        init("/{base_path}/assets/dioxus/{app_name}_bg.wasm").then(wasm => {
            if (wasm.__wbindgen_start == undefined) {
                wasm.main();
            }
        });
    </script>
</body>

</html>

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

No branches or pull requests

3 participants