Refactorisation de Vite
This commit is contained in:
@@ -1,16 +1,14 @@
|
||||
<?php
|
||||
namespace app\modules\site;
|
||||
|
||||
use Piko;
|
||||
use Piko\Module\Event\CreateControllerEvent;
|
||||
use Piko\Controller\Event\BeforeActionEvent;
|
||||
use app\lib\Vite;
|
||||
|
||||
class Module extends \Piko\Module
|
||||
{
|
||||
public function bootstrap()
|
||||
{
|
||||
Piko::setAlias('@vite_web', '/dev');
|
||||
|
||||
// Instanciate once i18n to setup the language config
|
||||
$this->application->getComponent('Piko\I18n');
|
||||
|
||||
@@ -21,7 +19,9 @@ class Module extends \Piko\Module
|
||||
$view = $this->application->getComponent('Piko\View');
|
||||
$view->params['user'] = $user;
|
||||
$view->params['language'] = $this->application->language;
|
||||
$view->attachBehavior('vite', 'app\lib\Vite::vite');
|
||||
// $view->attachBehavior('vite', 'app\lib\Vite::vite');
|
||||
$vite = new Vite($view);
|
||||
$vite->loadEntry('main.js');
|
||||
|
||||
$userModule = $this->application->getModule('user');
|
||||
assert ($userModule instanceof \app\modules\user\Module);
|
||||
|
||||
@@ -14,7 +14,6 @@ if (!$this->title) $this->title = 'Openai';
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title><?= $this->escape($this->title) ?></title>
|
||||
<?= $this->head() ?>
|
||||
<?= $this->vite('main.css') ?>
|
||||
</head>
|
||||
<body>
|
||||
<nav class="offcanvas offcanvas-start" tabindex="-1" id="offcanvasNavbar" aria-labelledby="offcanvasNavbarLabel">
|
||||
@@ -63,7 +62,7 @@ if (!$this->title) $this->title = 'Openai';
|
||||
<span class="hamb-bottom"></span>
|
||||
</button>
|
||||
|
||||
|
||||
|
||||
<?php if (isset($this->params['message']) && is_array($this->params['message'])): ?>
|
||||
<div class="container alert alert-<?= $this->params['message']['type'] ?> alert-dismissible fade show" role="alert">
|
||||
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
||||
@@ -73,6 +72,5 @@ if (!$this->title) $this->title = 'Openai';
|
||||
<?= $content ?>
|
||||
|
||||
<?= $this->endBody() ?>
|
||||
<?= $this->vite('main.js') ?>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -11,13 +11,11 @@ if (!$this->title) $this->title = 'Openai';
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title><?= $this->escape($this->title) ?></title>
|
||||
<?= $this->head() ?>
|
||||
<?= $this->vite('main.css') ?>
|
||||
</head>
|
||||
<body class="d-flex align-items-center py-4">
|
||||
|
||||
<?= $content ?>
|
||||
|
||||
<?= $this->endBody() ?>
|
||||
<?= $this->vite('main.js') ?>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user