https://github.com/zigomir/carinthia
turbolinks rip-off
https://github.com/zigomir/carinthia
Last synced: about 2 months ago
JSON representation
turbolinks rip-off
- Host: GitHub
- URL: https://github.com/zigomir/carinthia
- Owner: zigomir
- Created: 2020-12-28T15:54:37.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2021-01-04T12:20:43.000Z (over 5 years ago)
- Last Synced: 2025-03-01T00:14:14.882Z (over 1 year ago)
- Language: JavaScript
- Size: 139 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# carinthia
> follow links, morph the dom
## inspiration
- [turbo](https://turbo.hotwire.dev/)
- [htmx](https://htmx.org/)
## assumptions
- all pages load same css & js files, e.g. have same `head` element except
## limitations
- currently this only works for links, `a` tag with valid `href` attribute
## how to use it with SPA frameworks like vue
```js
document.addEventListener('carinthia:load', () => {
createApp(App).mount('#app')
})
```
- ensure Vue app bundle is present on all pages, or else it won't work if coming from a page that doesn't include it
- if you want your client side app generated links to also work, add `x-carinthia-enhance` attribute to app's root element
## todo
- [x] try out how this plays with Vue (or other) client side libraries
- [x] don't hijack "navigate" for non-local links; see https://github.com/bigskysoftware/htmx/blob/master/dist/htmx.js#L847-L851