Last active
August 12, 2024 08:03
-
-
Save reggi/24d52508b466fb80e9516e0e99329091 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Plugin } from "$fresh/server.ts"; | |
const sources = [ | |
"https://raw.githubusercontent.com/bigskysoftware/htmx/dev/src/htmx.js", | |
"https://raw.githubusercontent.com/bigskysoftware/htmx/dev/src/ext/head-support.js" | |
] | |
export default function htmx(): Plugin { | |
const main = `data:application/javascript,${sources.map(s => `import "${s}";`).join('')} export default () => {}` | |
return { | |
name: "htmx", | |
entrypoints: { "main": main }, | |
render(ctx) { | |
ctx.render(); | |
return { | |
scripts: [{ entrypoint: "main", state: [] }], | |
}; | |
}, | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment