Skip to main content

three_script

Function three_script 

Source
pub fn three_script() -> Markup
Expand description

Renders the tags that load Three.js and the plugin runtime.

Put it in the page <head>, before any page module that imports THREE_MODULE_URL. Else that import loads Three.js first, without SRI. Module scripts run after parsing, so the scenes in <body> exist when init.js runs.

use autumn_plugin_three::three_script;
use autumn_web::html;

let head = html! { head { (three_script()) } }.into_string();
assert!(head.contains(r#"type="module""#));
assert!(head.contains(r#"rel="modulepreload""#));