Releases: rossrobino/domco
Releases · rossrobino/domco
[email protected]
[email protected]
Minor Changes
- 8428e9a: feat: [Injector] adds
main
method to inject into themain
element. A singleTagDescriptor
can now be provided instead of an array into injection methods.
[email protected]
[email protected]
Patch Changes
- f545aa5: fix: sets
envDir
to cwd by default
[email protected]
[email protected]
[email protected]
Minor Changes
-
5088e8d: HTML
Injector
Easily manipulate HTML on the server with the
Injector
helper. -
Stabilizes the HTML
Injector
helper -
Adds
Injector
testsimport { Injector } from "domco/injector"; const injector = new Injector( `<!doctype html><html><body><!-- comment --></body></html>`, ); injector // Set or change the title .title("My Title") // pass a TagDescriptor .head([{ name: "script", attrs: { type: "module", src: "./script.js" } }]) // pass a string of text .body("Prepended to the body! ", "prepend") // replace comments .comment("comment", "My comment") // stringify HTML .toString();
Produces the following HTML.
<!doctype html> <html> <head> <title>My Title</title> <script type="module" src="./script.js"></script> </head> <body> Prepended to the body! My comment </body> </html>
[email protected]
Patch Changes
- 9a0295c: bump domco version
[email protected]
Patch Changes
-
9605fe3:
prerender
export can now be a function that returns an array or set of paths to prerender like in react-router v7. This makes it easier to prerender programmatically without having to create another function.// src/server/+func.ts import type { Prerender } from "domco"; // prerender can still be a value, for example: export const prerender: Prerender = ["/prerender"]; export const prerender: Prerender = new Set(["/prerender"]); // now prerender can also be a function, for example: export const prerender: Prerender = () => ["/prerender"]; export const prerender: Prerender = async () => new Set(["/prerender"]);