Hey i’m using laravel 9 here and im using the SB ADMIN template from bootstrap , i’m making the template as a component <x-dashboard >...</x-dashboard>
and i’m passing children inside it ! but i want the children to have it’s own css ( not the bootstrap one ) which is in my app.css file i added the head just so i can link the css file to the blade file but still doesn’t work any solutions ?
seeProscpect.blade.php
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="{{ asset('../css/app.css') }}">
</head>
<body>
<x-dashboard >
<h3 class="changeColor">TRYING CSS</h3>
</x-dashboard>
</body>
</html>
app.css
.changeColor {
color: green;
}
2
Answers
You have to use @pushonce for this purpose.
Inside your
<head>
after all other CSS script put@stack('css')
Ex:
Then from your children blade, add @push or @pushonce
Ex: