-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for dynamic file extensions #51
Conversation
It would be nice if more than one extension could be used at a time in a single application. For instance if you could pass the extension in the route method, and render with a markdown parser in one directory, then call Or otherwise have an array of supported extensions that one can check for when calling |
This might be something for another PR. Otherwise, I gave control to MountPath in case there is a future update for multiple routers. Latest commit works with method chaining: Folio::withExtension('.svelte')->renderUsing(function (Request $request, MatchedView $matchedView) {
return Inertia::render($matchedView->componentPath(), $matchedView->data);
})->route(resource_path('js/Pages'), middleware: [
'*' => [
//
],
]); |
I think this is kinda neat, but, unlike Volt / PHP there would be no convenient way to get additional data into the Inertia page. For example if you needed to load in additional data via a separate query / API call to pass to the Inertia page. |
Can the routes be intercepted/overridden by a traditional route or controller? This would allow you to quickly build out all your basic stuff, then go back through and sprinkle in a route/controller here and there where needed. EDIT: Crossed out a section. I was thinking about it backwards, being it's a fallback route. |
Yes, in a fresh Laravel app, the routing defined using the RouteServiceProvider will take precedence over the routing defined in the FolioServiceProvider. Complex queries should take place in middleware or in a dedicated route/controller. // web.php
Route::get('/stories/breaking-news', function () {
$news = News::with(['images', 'comments'])
->whereBreaking()
->orderBy('edited_at', 'desc')
->get();
Inertia::render('/news/index', compact('news'));
}); The coexisting folder structure lets you fetch data from route parameters such as a news story with a unique slug:
|
I may revisit this at some point but going to let Folio settle a bit first. |
Makes it possible to support non
.blade.php
extensions. Intended for use with Inertia.Syntax:
Example Inertia renderer for Folio: