Laravel Asset Links not working - html

I want to install the "Metronic" Admin Theme in Laravel and therefore adjust the links in the header to the correct paths.
The current header looks like this:
<head>
<meta charset="utf-8" />
<title>Metronic Admin Theme #1 | Blank Page Layout</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta content="width=device-width, initial-scale=1" name="viewport" />
<meta content="Preview page of Metronic Admin Theme #1 for blank page layout" name="description" />
<meta content="" name="author" />
<!-- BEGIN GLOBAL MANDATORY STYLES -->
<link href="http://fonts.googleapis.com/css?family=Open+Sans:400,300,600,700&subset=all" rel="stylesheet" type="text/css" />
<link href="../assets/global/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css" />
<link href="../assets/global/plugins/simple-line-icons/simple-line-icons.min.css" rel="stylesheet" type="text/css" />
<link href="../assets/global/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<link href="../assets/global/plugins/bootstrap-switch/css/bootstrap-switch.min.css" rel="stylesheet" type="text/css" />
<!-- END GLOBAL MANDATORY STYLES -->
<!-- BEGIN THEME GLOBAL STYLES -->
<link href="../assets/global/css/components.min.css" rel="stylesheet" id="style_components" type="text/css" />
<link href="../assets/global/css/plugins.min.css" rel="stylesheet" type="text/css" />
<!-- END THEME GLOBAL STYLES -->
<!-- BEGIN THEME LAYOUT STYLES -->
<link href="../assets/layouts/layout/css/layout.min.css" rel="stylesheet" type="text/css" />
<link href="../assets/layouts/layout/css/themes/darkblue.min.css" rel="stylesheet" type="text/css" id="style_color" />
<link href="../assets/layouts/layout/css/custom.min.css" rel="stylesheet" type="text/css" />
<!-- END THEME LAYOUT STYLES -->
<link rel="shortcut icon" href="favicon.ico" /> </head>
<!-- END HEAD -->
I copied all the folders needed into the resources/assets/ folder, but still it is not found when loading the page and no matter how I change the path it is not found. How would I need to adjust this correctly?

you can use {{asset}} which allows you to link to an asset within
your public directory
try
<link href="{{ asset('/global/css/components.min.css') }}"" rel="stylesheet" type="text/css" />
https://laravel.com/docs/5.4/helpers#method-asset

Copy assets folder of Metronic theme and past to your application's public folder. Add your resource link by following line:
<link href="/assets/global/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css" />

By Metronic you maybe forgot to call
npm run dev
or
npm run prod
according to docs
Metronic Laravel

Related

Why my layout doesn't work properly in welcome.blade

i'm working on a laravel project and i prepared a layout for welcome.blade but css and html don't work properly . somehow the project can't read them .
i make you sure that my paths is correct
even i change folders and paths in public but it didn't work
<!DOCTYPE html>
<html lang="fa">
<head>
<meta charset="UTF-8">
<meta name="description" content="MealOrder">
<meta name="keywords" content="HTML,CSS,JavaScript">
<meta name="author" content="HiBootstrap">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<title>Fafo - قالب رستوران و فست فود</title>
<link rel="icon" src="/assets/images/tab.png" type="image/png" sizes="16x16">
<link rel="stylesheet" src="/assets/css/bootstrap-reboot.min.css" type="text/css" media="all" />
<link rel="stylesheet" src="/assets/css/bootstrap.rtl.min.css" type="text/css" media="all" />
<link rel="stylesheet" src="/assets/css/animate.min.css" type="text/css" media="all" />
<link rel="stylesheet" src="/assets/css/owl.carousel.min.css" type="text/css" media="all" />
<link rel="stylesheet" src="/assets/css/owl.theme.default.min.css" type="text/css" media="all" />
<link rel="stylesheet" src="/assets/css/jquery-ui.css" type="text/css" media="all" />
<link rel="stylesheet" src="/assets/css/responsive.css" type="text/css" media="all" />
#livewireStyles
</head>
<body>
.
.
.
.
<script src="/assets/js/jquery-3.5.1.min.js"></script>
<script src="/assets/js/bootstrap.bundle.min.js"></script>
<script src="/assets/js/jquery-ui.js"></script>
#livewireScripts
</body>
</html>
I assume you use Laravel 9 because Laravel now is using vite instead of webpack/laravel-mix as we used to see, and the way vite injects styles & scripts in layouts pages are not the same as it was.
you will need to add the following blade directive into your layout file:
#vite(['resources/css/app.css', 'resources/js/app.js'])
and then re-run npm run build or npm run dev to re-bundle your assets.
more about Bundling Assets (Vite)
its better change all src to asset() for example:
instead of
write
<link rel="stylesheet" src="{{asset('assets/css/animate.min.css')}}" type="text/css" media="all" />
and for scripts do same

How to set/link favicon in yield laravel on chrome?

I want to put my link icon in yield and it doesn't work,
If I put on section it work smoothly. I don't want to put it in every page.
Here is my code
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<title>#yield('title')</title>
<meta content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0, shrink-to-fit=no' name='viewport' />
<!-- Fonts and icons -->
<link href="https://fonts.googleapis.com/css?family=Montserrat:400,700,200" rel="stylesheet" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/latest/css/font-awesome.min.css" />
<link rel="shortcut icon" sizes="72x72" href="{{{ asset('assets/img/ficon.png') }}}">
<!-- CSS Files -->
<link href="./assets/css/bootstrap.min.css" rel="stylesheet" />
<link href="./assets/css/now-ui-kit.css?v=1.1.0" rel="stylesheet" />
<!-- CSS Just for demo purpose, don't include it in your project -->
<link href="./assets/css/demo.css" rel="stylesheet" />
Update :: I was open in firefox it works but can't display on chrome, also I was update my chrome but still not working...
try adding the size, your png might be too big.
//resize the image using a photo editing software to either 144x144,114x114 or 72x72
//then specify the size like below
<link rel="shortcut icon" sizes="114x114" href="{{{ asset('assets/img/ficon.png') }}}">
or try this:
<link rel="shortcut icon" sizes="114x114" href="assets/img/ficon.png">
you can also try this solution found here to fix the chrome issue

convert Html to Cshtml

How do I convert this to cshtml with razor tags?
<head>
<!-- Basic -->
<meta charset="UTF-8">
<title>Modals | SHARED ON THEMELOCK.COM</title>
<meta name="keywords" content="HTML5 Admin Template" />
<meta name="description" content="Porto Admin - Responsive HTML5 Template">
<meta name="author" content="okler.net">
<!-- Mobile Metas -->
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<!-- Web Fonts -->
<link href="http://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700,800|Shadows+Into+Light" rel="stylesheet" type="text/css">
<!-- Vendor CSS -->
<link rel="stylesheet" href="assets/vendor/bootstrap/css/bootstrap.css" />
<link rel="stylesheet" href="assets/vendor/font-awesome/css/font-awesome.css" />
<link rel="stylesheet" href="assets/vendor/magnific-popup/magnific-popup.css" />
<link rel="stylesheet" href="assets/vendor/bootstrap-datepicker/css/datepicker3.css" />
<!-- Specific Page Vendor CSS -->
<link rel="stylesheet" href="assets/vendor/pnotify/pnotify.custom.css" />
<!-- Theme CSS -->
<link rel="stylesheet" href="assets/stylesheets/theme.css" />
<!-- Skin CSS -->
<link rel="stylesheet" href="assets/stylesheets/skins/default.css" />
<!-- Theme Custom CSS -->
<link rel="stylesheet" href="assets/stylesheets/theme-custom.css">
<!-- Head Libs -->
<script src="assets/vendor/modernizr/modernizr.js"></script>
</head>
Lets start a journey:
Open HTML document
Click CTRL+A
Click CTRL+C
Enter to your solution directory
Create new empty *.cshtml file
Click CTRL+V
That's all - it will be work. (In future add in tags what version of .Net are you using and what exactly need because my answer is correct to your question. For more information about Razor read this)
Create a new cshtml file. and paste your code

Adding sass folder to codeigniter public folder

I have a codeigniter application where I am trying to implement the design I have currently implemented the design but some of the functionality is not working due to the sass not getting called I was wondering if anyone knows where I should be placing the sass folder and or if I should be altering the css files to call the sass.
Any help would be appreciated, thanks
My call to the css is as follows:
<link href="<?=base_url()?>public/assets/global/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css" />
<link href="<?=base_url()?>public/assets/global/plugins/simple-line-icons/simple-line-icons.min.css" rel="stylesheet" type="text/css" />
<link href="<?=base_url()?>public/assets/global/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<link href="<?=base_url()?>public/assets/global/plugins/uniform/css/uniform.default.css" rel="stylesheet" type="text/css" />
<link href="<?=base_url()?>public/assets/global/plugins/bootstrap-switch/css/bootstrap-switch.min.css" rel="stylesheet" type="text/css" />
<!-- END GLOBAL MANDATORY STYLES -->
<!-- BEGIN PAGE LEVEL PLUGINS -->
<link href="<?=base_url()?>public/assets/global/plugins/bootstrap-daterangepicker/daterangepicker.min.css" rel="stylesheet" type="text/css" />
<link href="<?=base_url()?>public/assets/global/plugins/morris/morris.css" rel="stylesheet" type="text/css" />
<link href="<?=base_url()?>public/assets/global/plugins/fullcalendar/fullcalendar.min.css" rel="stylesheet" type="text/css" />
<link href="<?=base_url()?>public/assets/global/plugins/jqvmap/jqvmap/jqvmap.css" rel="stylesheet" type="text/css" />
<!-- END PAGE LEVEL PLUGINS -->
<!-- BEGIN THEME GLOBAL STYLES -->
<link href="<?=base_url()?>public/assets/global/css/components-md.min.css" rel="stylesheet" id="style_components" type="text/css" />
<link href="<?=base_url()?>public/assets/global/css/plugins-md.min.css" rel="stylesheet" type="text/css" />
<!-- END THEME GLOBAL STYLES -->
<!-- BEGIN THEME LAYOUT STYLES -->
<link href="<?=base_url()?>public/assets/layouts/layout4/css/layout.min.css" rel="stylesheet" type="text/css" />
<link href="<?=base_url()?>public/assets/layouts/layout4/css/themes/light.min.css" rel="stylesheet" type="text/css" id="style_color" />
<link href="<?=base_url()?>public/assets/layouts/layout4/css/custom.min.css" rel="stylesheet" type=
I also have the sass just placed in the public/assets folder.
Your application should not be calling the SASS file. Instead app should call the CSS - compiled from the SASS.
I was wondering if anyone knows where I should be placing the sass
folder and or if I should be altering the css files to call the sass.
You can actually place it on any folder and when compiled will be placed in your assets folder.

CSS not linking when uploaded to a website

Can any of you spot an error here?? If there is one... I'm going bananas here... CSS page is not linking with html when uploaded to server. And W3 validation says "No Character Encoding Found! Falling back to UTF-8." ???
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Text</title>
<meta name="description" content="Another text">
<meta name="author" content="Content Text">
<link rel="shortcut icon" href="img/favicon.ico" type="image/x-icon" />
<link rel="icon" href="img/favicon.ico" type="image/x-icon" />
<meta name="viewport" content="initial-scale=1" />
<!-- Fonts -->
<link href='http://fonts.googleapis.com/css?family=Open+Sans:800' rel='stylesheet' type='text/css'><!-- About page Services -->
<link href='http://fonts.googleapis.com/css?family=Roboto+Slab' rel='stylesheet' type='text/css'> <!-- H1, h2 -->
<link href='http://fonts.googleapis.com/css?family=Molengo' rel='stylesheet' type='text/css'><!-- p -->
<!-- Stylesheets -->
<link href="css/normalize.css" rel="stylesheet" type="text/css" />
<link href="css/style.css" rel="stylesheet" type="text/css" />
<link href="css/grid.css" rel="stylesheet" type="text/css" />
<link href="css/style3.css" rel="stylesheet" type="text/css" />
Do you need
#charset "utf-8";
/* CSS Document */
before starting css files?
<?php include('inc/header.php'); ?>
<div id="index" class="container">
<div class="container">
That ok to do isn't it? this include line is top of the page and above all other content
Your index file is not getting parsed as php. 1) Did you give it a .php extension? 2) Does your server have php installed on it?