trunk-rs / trunk

Build, bundle & ship your Rust WASM application to the web.

Home Page:https://trunkrs.dev/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

<html><head> etc added to output even if it's not in `index.html`

Timmmm opened this issue · comments

Maybe I don't understand what index.html is meant to be (it looks like a template), but even if you make it just contain this:

 <link href="/style.css" rel="css" data-trunk/>

It still adds a load of stuff back:

<html><head><link rel="stylesheet" href="/style-d352aaa5319d2715.css" integrity="sha384-petqrs_Dw1wLsu_8JFJSvNhsbH_onGGEk5Y9I1kwWqntWOKCFQWEslIZ3LpAUxCg">

<link rel="preload" href="/chericap-bd1be7d3d2212b26_bg.wasm" as="fetch" type="application/wasm" crossorigin="anonymous" integrity="sha384-aqmxDIbxKKBaHTgbd68zZwcy67YvByHXGwUP-tzVVnCpQNlYih1ENUt23eZ61rpA">
<link rel="modulepreload" href="/chericap-bd1be7d3d2212b26.js" crossorigin="anonymous" integrity="sha384-voA-SCCvyaw92nveiMv-kfdSNN7qgXCiWLR2H9_s_yYkMJeVR9NB_0D9xhWyqmqf"></head><body>
<script type="module">
import init, * as bindings from '/chericap-bd1be7d3d2212b26.js';
init('/chericap-bd1be7d3d2212b26_bg.wasm');
window.wasmBindings = bindings;

</script></body></html>

I don't want it to have <html> <head> <body> etc because I am trying to embed this document in another existing HTML document.

The index.html currently is considered to be the entry point the user loads in the browser.

I am not sure what you're trying to do, but maybe it makes more sense for your case to just ignore the generated index.html and do the bootstrapping yourself.

I was trying to embed some Yew widgets in an Asciidoc document but it actually turned out to be easier to sort of so it the other way around, so I add some <div id="embed" in the Asciidoc, convert it to HTML in Trunk's pre-build hook and then inline it in index.html with <link rel="online".

Trunk helpfully strips the <html> tag from the Asciidoc. It does leave a meta charset tag which Chrome complains about in the console, but eh. Good enough for me!