{"id":16227084,"url":"https://github.com/voorjaar/fresh_mtos","last_synced_at":"2026-04-17T09:32:07.227Z","repository":{"id":63219179,"uuid":"566148109","full_name":"voorjaar/fresh_mtos","owner":"voorjaar","description":"A plugin for Deno Fresh that turns your site into a single page application.","archived":false,"fork":false,"pushed_at":"2022-11-15T06:10:48.000Z","size":67,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-03-13T04:49:16.361Z","etag":null,"topics":["deno","deno-module","denoland","fresh","mtos","spa"],"latest_commit_sha":null,"homepage":"https://deno.land/x/fresh_mtos","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/voorjaar.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-11-15T03:56:07.000Z","updated_at":"2022-11-15T05:39:52.000Z","dependencies_parsed_at":"2023-01-23T03:46:05.448Z","dependency_job_id":null,"html_url":"https://github.com/voorjaar/fresh_mtos","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/voorjaar/fresh_mtos","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voorjaar%2Ffresh_mtos","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voorjaar%2Ffresh_mtos/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voorjaar%2Ffresh_mtos/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voorjaar%2Ffresh_mtos/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/voorjaar","download_url":"https://codeload.github.com/voorjaar/fresh_mtos/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voorjaar%2Ffresh_mtos/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31923122,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-17T09:10:15.403Z","status":"ssl_error","status_checked_at":"2026-04-17T09:10:14.455Z","response_time":62,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["deno","deno-module","denoland","fresh","mtos","spa"],"created_at":"2024-10-10T12:51:34.744Z","updated_at":"2026-04-17T09:32:07.202Z","avatar_url":"https://github.com/voorjaar.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fresh_mtos\n\nA plugin for [Deno Fresh](https://fresh.deno.dev) that turns your site into a\nsingle page application.\n\n\u003e Checkout [this page](https://fresh-mtos.deno.dev/) for a live demo.\n\n## What it does?\n\nThe plugin adds [mtos](https://github.com/voorjaar/mtos) to your website.\n\n\u003e You still serve the static HTML files, but the user experience is the same as\n\u003e SPA with incremental requests via fetch API on the client side. And you can\n\u003e also add transition animations, progress bar, etc.\n\n## Installation\n\n1. [Create a fresh project](https://fresh.deno.dev/docs/getting-started/create-a-project)\n   if you haven't done so.\n\n2. Add `fresh_mtos` to your `import_map.json`\n\n   ```diff\n   {\n   \"imports\": {\n       \"$fresh/\": \"https://deno.land/x/fresh@1.1.1/\",\n   +   \"$fresh_mtos/\": \"https://deno.land/x/fresh_mtos/\",\n       \"$std/\": \"https://deno.land/std@0.145.0/\",\n       \"$gfm\": \"https://deno.land/x/gfm@0.1.22/mod.ts\",\n       \"preact\": \"https://esm.sh/preact@10.11.0\",\n       \"preact/\": \"https://esm.sh/preact@10.11.0/\",\n       \"preact-render-to-string\": \"https://esm.sh/*preact-render-to-string@5.2.4\",\n       \"@preact/signals\": \"https://esm.sh/*@preact/signals@1.0.3\",\n       \"@preact/signals-core\": \"https://esm.sh/*@preact/signals-core@1.0.1\",\n       \"twind\": \"https://esm.sh/twind@0.16.17\",\n       \"twind/\": \"https://esm.sh/twind@0.16.17/\"\n   }\n   }\n   ```\n\n3. Create a configuration file called `mtos.config.ts`.\n\n   ```ts\n   import type { Options } from \"$fresh_mtos/mod.ts\";\n\n   export default {\n     selfURL: import.meta.url,\n   } as Options;\n   ```\n\n   You can also use the `defineConfig` API.\n\n   ```ts\n   import { defineConfig } from \"$fresh_mtos/mod.ts\";\n\n   export default defineConfig({\n     selfURL: import.meta.url,\n   });\n   ```\n\n4. Add the plugin to your `main.ts`\n\n   ```ts\n   /// \u003creference no-default-lib=\"true\" /\u003e\n   /// \u003creference lib=\"dom\" /\u003e\n   /// \u003creference lib=\"dom.iterable\" /\u003e\n   /// \u003creference lib=\"dom.asynciterable\" /\u003e\n   /// \u003creference lib=\"deno.ns\" /\u003e\n\n   import { start } from \"$fresh/server.ts\";\n   import manifest from \"./fresh.gen.ts\";\n\n   import twindPlugin from \"$fresh/plugins/twind.ts\";\n   import twindConfig from \"./twind.config.ts\";\n   import mtosConfig from \"./mtos.config.ts\";\n   import mtosPlugin from \"$fresh_mtos/mod.ts\";\n\n   await start(manifest, {\n     plugins: [\n       twindPlugin(twindConfig),\n       mtosPlugin(mtosConfig),\n     ],\n   });\n   ```\n\n## Options\n\nThe below options can be used to setup [mtos](https://github.com/voorjaar/mtos).\n\n```ts\ninterface Options {\n  /** Eval Script Element When Update, Default is false */\n  eval?: boolean;\n\n  /** Fetch Options */\n  fetch?: RequestInit;\n\n  /** Auto Scroll Behavior */\n  scroll?: {\n    enable?: boolean;\n    left?: number;\n    top?: number;\n    behavior?: \"auto\" | \"smooth\";\n  };\n\n  /** Fetch Hooks */\n  onMatch: (a: HTMLAnchorElement) =\u003e boolean;\n  onFetchStart?(href: string): boolean | undefined | void;\n  onFetchEnd?: (html: string, href: string) =\u003e string | undefined | void;\n  onFetchError?: (error: Error, href: string) =\u003e void;\n\n  /** Render Hooks */\n  onBeforePageRendered?: (href: string) =\u003e void;\n  onPageRendered?: (href: string) =\u003e void;\n\n  /** Dom Patch Hooks */\n  getNodeKey?: (node: Node) =\u003e any;\n  onBeforeNodeAdded?: (node: Node) =\u003e Node;\n  onNodeAdded?: (node: Node) =\u003e Node;\n  onBeforeElUpdated?: (fromEl: HTMLElement, toEl: HTMLElement) =\u003e boolean;\n  onElUpdated?: (el: HTMLElement) =\u003e void;\n  onBeforeNodeDiscarded?: (node: Node) =\u003e boolean;\n  onNodeDiscarded?: (node: Node) =\u003e void;\n  onBeforeElChildrenUpdated?: (\n    fromEl: HTMLElement,\n    toEl: HTMLElement,\n  ) =\u003e boolean;\n}\n```\n\n## License\n\n[MIT](https://github.com/voorjaar/fresh_mtos/blob/main/LICENSE)\n\nCopyright (c) 2022, Raven Satir\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvoorjaar%2Ffresh_mtos","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvoorjaar%2Ffresh_mtos","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvoorjaar%2Ffresh_mtos/lists"}