'Modify style files links from the subfolder blade file, extended from master layout file - Laravel
I'm new to laravel. I use master.blade as the main layout of my website. Just wondering if there is any way to add an extra word with CSS links written inside master.blade from the child class.
For example, below is master.blade inside the layouts folder of views.
<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
<title>@yield('title')</title>
@section('meta_tags')
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="format-detection" content="telephone=no">
<!-- CSRF Token -->
<meta name="csrf-token" content="{{ csrf_token() }}">
@show
<!-- CSS Style -->
@section('styles')
<link rel="icon" type="image/png" href="assets/images/favicon.png"><!-- fonts -->
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:400,400i,500,500i,700,700i"><!-- css -->
<link rel="stylesheet" href="assets/vendor/bootstrap/css/bootstrap.css">
<link rel="stylesheet" href="assets/vendor/owl-carousel/assets/owl.carousel.min.css">
<link rel="stylesheet" href="assets/vendor/photoswipe/photoswipe.css">
<link rel="stylesheet" href="assets/vendor/photoswipe/default-skin/default-skin.css">
<link rel="stylesheet" href="assets/vendor/select2/css/select2.min.css">
<link rel="stylesheet" href="assets/css/style.css">
<link rel="stylesheet" href="assets/css/style.header-spaceship-variant-one.css" media="(min-width: 1200px)">
<link rel="stylesheet" href="assets/css/style.mobile-header-variant-one.css" media="(max-width: 1199px)">
<!-- font - fontawesome -->
<link rel="stylesheet" href="assets/vendor/fontawesome/css/all.min.css">
@show
</head>
<body>
<div class="site">
{{-- ------------------ H E A D E R ------------------ --}}
@section('header')
@include('includes.header')
@show
{{-- ------------------ C O N T E N T ------------------ --}}
@section('content')
<div class="container-fluid">
@include('includes.message')
@yield('content')
</div>
@show
{{-- ------------------ F O O T E R ------------------ --}}
@section('footer')
@include('includes.footer')
@show
</div>
</body>
</html>
Below is the class in which CSS is loading perfectly fine because it is inside the UI folder of the view and the links are
welcome.blade.php
@extends('layouts.master')
@section('title', 'Saleem Motors')
@section('content')
// Some content
@endsection
But when the blade file is inside the subfolder of the ui folder, it is not loading. I have to copy all the CSS links and paste them into each blade file manually and add ../ to make it CSS files work there. i.e. I have to change
<link rel="stylesheet" href="assets/css/style.css">
to this in each subfolder blade file
<link rel="stylesheet" href="../assets/css/style.css">
Now my question is,
Is there any way to automatically add ../ or this ../../ for subfolder blade files to get CSS links added in master.blade layout file to make it work as desired???
I'm bad at explaining things, I hope you get the point.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|

