Inertia.js Adapter for Statamic
Published on by Paul Redmond
Inertia-statamic by Adam Campbell is a Statamic server-side adapter for Intertia.js used to build single-page apps without building an API.
🚀 I'm pumped to announce my new @inertiajs adapter for @statamic.
— Adam Campbell (@hotmeteor) May 3, 2021
I've been a long time fan and user of Inertia.js, and a recent adopter of Statamic. I wanted them to "just work" together! And now they do.
Check it out. Issues and comments welcome.https://t.co/CiGPnCos9H
The Intertia.js adapter will work for Statamic pages or content available through Statamic collections. Once you follow the readme setup instructions, Statamic page objects will be available in given Vue components as props.
Here's a visualization of props given in the project's readme:
Inertia\Response {#2587 ▼ #component: "Marketing/Overview" #props: array:22 [▼ "amp_url" => null "api_url" => null "collection" => array:3 [▶] "content" => array:4 [▶] "date" => Illuminate\Support\Carbon @1617827556 {#2478 ▶} "edit_url" => "http://mysite.test/cp/collections/marketing/entries/f854a1cf-0dcf-404b-8418-a74662ba77e7/overview" "id" => "f854a1cf-0dcf-404b-8418-a74662ba77e7" "is_entry" => true "last_modified" => Illuminate\Support\Carbon @1617827556 {#2477 ▶} "mount" => null "order" => null "parent" => null "permalink" => "http://mysite.test/marketing" "private" => false "published" => true "slug" => "overview" "template" => "app" "title" => "Overview" "updated_at" => Illuminate\Support\Carbon @1617827556 {#2523 ▶} "updated_by" => array:4 [▶] "uri" => "/marketing" "url" => "/marketing" ] #rootView: "app" #version: "" #viewData: []
You can learn more about this package, get full installation instructions, and view the source code on GitHub. Since this package uses Statamic and Intertia.js, check out the Inertia.js documentation and the Statamic 3 Docs.