Back to packages list

Vals using preact-render-to-string

Description from the NPM package:
Render JSX to an HTML string, with support for Preact components.
rapfl avatar
rapfl
zottify
HTTP
@jsxImportSource https://esm.sh/preact
0
overengineered avatar
overengineered
status
HTTP
Forked from stevekrouse/status
0
moe avatar
moe
responses
Script
An interactive, runnable TypeScript val by moe
0
jxnblk avatar
jxnblk
test
HTTP
A test utility and badge to put in your val readme to show test suite status Example: Usage: Make a val Make a separate test suite HTTP val for the val you want to test Import describe and it utilities Write tests Add the badge to your readme, with the url parameter pointing to the test suite val's endpoint. Tests run whenever the test suite val or the badge is fetched import { describe, it } from "https://esm.town/v/jxnblk/test"; import { assertEquals } from "jsr:@std/assert@1"; export default describe("my test suite", () => { const sum = (a, b) => a + b; it("sums it up", () => { assertEquals(sum(1, 2), 3); }) }) Badge: [![][badge]][url] [badge]: https://jxnblk-test.web.val.run?url=YOUR_TEST_SUITE_ENDPOINT [url]: YOUR_TEST_SUITE_URL Example [![][badge]][url] [badge]: https://jxnblk-test.web.val.run?url=https://jxnblk-tunatestsuite.web.val.run [url]: https://www.val.town/v/jxnblk/tunaTestSuite
2
willthereader avatar
willthereader
mythBusterGraduationEdition
HTTP
@jsxImportSource https://esm.sh/preact
0
deepfates avatar
deepfates
greenWren
HTTP
Forked from deepfates/HTMX_template
0
tempguy avatar
tempguy
tomatoSawfish
HTTP
@jsxImportSource https://esm.sh/preact
0
karkowg avatar
karkowg
fav
HTTP
fav Turn an emoji into an SVG favicon. Inspired by Lea's tweet . Usage <link rel="icon" href="https://karkowg-fav.web.val.run?emoji=🧨" /> Alternatively, you can use Wes Bos' fav.farm .
1
avycado13 avatar
avycado13
valboard
HTTP
Forked from stevekrouse/linkInBioTemplate
0
iamseeley avatar
iamseeley
preactExample
HTTP
@jsxImportSource https://esm.sh/preact
0
neverstew avatar
neverstew
ivoryPorpoise
HTTP
@jsxImportSource https://esm.sh/preact
0
janpaul123 avatar
janpaul123
valtownsemanticsearch
HTTP
Forked from pomdtr/valTownSearch
3
jxnblk avatar
jxnblk
snake
HTTP
// WIP turn-based snake game built in Val Town
0
jxnblk avatar
jxnblk
valTownBadgeExample
HTTP
Example of how to add a Val Town badge to your val Demo: https://jxnblk-valtownbadgeexample.web.val.run/ Option 1 Wrap your HTTP response handler with https://www.val.town/v/jxnblk/valTownBadgeMiddleware [^1] import wrapper from "https://esm.town/v/jxnblk/valTownBadgeMiddleware"; async function handler(req: Request): Promise<Response> { const html = ` <h1>Hello, world</h1> `; return new Response(html, { headers: { "Content-Type": "text/html; charset=utf-8", }, }); } export default wrapper(handler, import.meta.url); Option 2 Get the HTML string for the badge using https://www.val.town/v/jxnblk/valTownBadge Add the HTML to your response's HTML string wherever you like import valTownBadge from "https://esm.town/v/jxnblk/valTownBadge"; export default async function(req: Request): Promise<Response> { const badge = valTownBadge(import.meta.url); const html = ` <h1>Hello, world</h1> ${badge} `; return new Response(html, { headers: { "Content-Type": "text/html; charset=utf-8", }, }); } Manual options You can also edit the snippet below to manually add the badge in HTML <a href="https://www.val.town/v/jxnblk/valTownBadgeExample" target="_blank" style="text-decoration:none;color:inherit"> <img src="https://jxnblk-valtownbadgesvg.web.val.run/" width="160" height="160"> </a> Or markdown: [![View source on Val Town](https://jxnblk-valtownbadgesvg.web.val.run/)](https://www.val.town/v/jxnblk/valTownBadgeExample) [^1]: Middleware is not recommended when using client-side hydration in apps like React or when returning a full, valid HTML response
0
emilycoe avatar
emilycoe
ilyBday
HTTP
@jsxImportSource https://esm.sh/preact
0
jxnblk avatar
jxnblk
svg_favicon
HTTP
Forked from jxnblk/svg_card
1