Created
July 13, 2022 00:58
-
-
Save sawirricardo/c057389ca585de0f87cdadacc3955f3a to your computer and use it in GitHub Desktop.
Filament Vite
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@import "../../vendor/filament/filament/resources/css/app.css"; | |
@tailwind base; | |
@tailwind components; | |
@tailwind utilities; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Providers; | |
use Filament\Facades\Filament; | |
use Illuminate\Support\Facades\App; | |
use Illuminate\Support\Facades\Blade; | |
use Illuminate\Support\ServiceProvider; | |
class AppServiceProvider extends ServiceProvider | |
{ | |
/** | |
* Register any application services. | |
* | |
* @return void | |
*/ | |
public function register() | |
{ | |
// | |
} | |
/** | |
* Bootstrap any application services. | |
* | |
* @return void | |
*/ | |
public function boot() | |
{ | |
Filament::serving(function () { | |
Filament::registerRenderHook( | |
'body.start', | |
fn (): string => Blade::render('@vite(["resources/js/app.js", "resources/css/app.css"])'), | |
); | |
}); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { defineConfig } from "vite"; | |
import laravel from "laravel-vite-plugin"; | |
import fs from "fs"; | |
import { homedir } from "os"; | |
import { resolve } from "path"; | |
let host = "hivivaldy.test"; | |
export default defineConfig({ | |
plugins: [ | |
laravel({ | |
input: ["resources/css/app.css", "resources/js/app.js"], | |
refresh: true, | |
}), | |
], | |
server: detectServerConfig(host), | |
}); | |
function detectServerConfig(host) { | |
let keyPath = resolve(homedir(), `.config/valet/Certificates/${host}.key`); | |
let certificatePath = resolve( | |
homedir(), | |
`.config/valet/Certificates/${host}.crt` | |
); | |
if (!fs.existsSync(keyPath)) { | |
return {}; | |
} | |
if (!fs.existsSync(certificatePath)) { | |
return {}; | |
} | |
return { | |
hmr: { host }, | |
host, | |
https: { | |
key: fs.readFileSync(keyPath), | |
cert: fs.readFileSync(certificatePath), | |
}, | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment