Skip to content

Instantly share code, notes, and snippets.

@reggi
Last active January 27, 2024 16:17
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save reggi/24d52508b466fb80e9516e0e99329091 to your computer and use it in GitHub Desktop.
Save reggi/24d52508b466fb80e9516e0e99329091 to your computer and use it in GitHub Desktop.
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