StaticHTMLFile
The StaticHTMLFile resource creates static HTML files with automatic directory creation and cleanup.
Minimal Example
Section titled “Minimal Example”Creates a basic HTML file:
import { StaticHTMLFile } from "alchemy/fs";
const page = await StaticHTMLFile( "index.html", ` <!DOCTYPE html> <html> <head><title>My Page</title></head> <body>Hello World</body> </html>`);
Custom Path
Section titled “Custom Path”Creates an HTML file at a specific path:
import { StaticHTMLFile } from "alchemy/fs";
const page = await StaticHTMLFile( "home", "pages/index.html", ` <!DOCTYPE html> <html> <head> <title>Home</title> <link rel="stylesheet" href="style.css"> </head> <body> <h1>Welcome</h1> <p>This is my homepage.</p> </body> </html>`);