Skip to content

Commit

Permalink
👍 Add custom component twig
Browse files Browse the repository at this point in the history
  • Loading branch information
juzaweb committed May 5, 2024
1 parent 70264c0 commit ee1bc6d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@
"laravel/passport": "^10.4",
"rcrowe/twigbridge": "^0.14",
"spatie/image-optimizer": "^1.4",
"spatie/laravel-activitylog": "^4.7",
"performing/twig-components": "^0.5.3",
"league/fractal": "^0.20.1",
"laravel/sanctum": "^3.3"
},
Expand Down
7 changes: 7 additions & 0 deletions modules/Frontend/Providers/FrontendServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use Illuminate\Console\Events\CommandFinished;
use Juzaweb\CMS\Contracts\LocalThemeRepositoryContract;
use Juzaweb\CMS\Support\ServiceProvider;
use Performing\TwigComponents\Configuration;

class FrontendServiceProvider extends ServiceProvider
{
Expand All @@ -26,6 +27,12 @@ public function boot(): void
{
$currentTheme = $this->app[LocalThemeRepositoryContract::class]->currentTheme();

Configuration::make($this->app['twig'])
->setTemplatesPath($currentTheme->getPath('views/components'))
->setTemplatesExtension('twig')
->useCustomTags()
->setup();

if ($currentTheme->getTemplate() == 'inertia') {
config(['inertia.ssr.bundle' => $currentTheme->getPath('assets/ssr/ssr.mjs')]);
}
Expand Down

0 comments on commit ee1bc6d

Please sign in to comment.