Referencing local folders into head laravel - php

Im including custom bootstrap folder & css into laravel index, but none ofmy tries works, appreciate help of how to make it.
i have placed the folders in public folder of lavarel
<link href="css/StyleSheet_landingPage.css" rel="stylesheet">
<link href="Content/font-awesome.min.css" rel="stylesheet" />
Root order

As #Harven suggested in the comments, you should read up on using the asset helper method with Laravel.
Assuming your stylesheet lives at the following:
Laravel/public/css/StyleSheet_landingPage.css
Then this will work.
<link href="{{ asset('css/StyleSheet_landingPage.css') }}" rel="stylesheet" type="text/css" >

Try maybe just like here:
<link href="/css/StyleSheet_landingPage.css" rel="stylesheet">
<link href="/Content/font-awesome.min.css" rel="stylesheet" />

Related

Laravel 8 asset helpers not working in my new project

so I created a new laravel project and use npm run dev to generate my css file inside public folder.
like my last project i tried to load my CSS like this
<link href="{{ URL::asset('/css/app.css') }}" rel="stylesheet" type="text/css">
but that doesn't work. my folder structure is like this
public
css
app.css
I checked a lot of posts but non of them worked. the only way to load the file is like this
<link href="{{ mix('/css/app.css') }}" rel="stylesheet" type="text/css" >
or
<link href="/css/app.css" rel="stylesheet" type="text/css" >
my question is why asset helper don't work ?
i tried changing the url, changing env 'ASSET_URL', etc
I know this is a really elementary issue, but this question are making me crazy,
btw my last project laravel version was 7 but this one version is 8
Use proper path in laravel asset() helper function.
asset() helper function access from app/public directory.
<link href="{{ asset('css/app.css') }}" rel="stylesheet" type="text/css">

Synfony3: How to work with assets and path

Hello everyone: i'm deploying my project. Pointed the URL to the web folder when I call the url the login page shows but with non css or js, and the buttons calls doesn't work.
This is how I call the css/js or links to some path
<link href="{{ asset('css/main.css') }}" rel="stylesheet" />
add
and this is what it translate
<link href="/project/web/css/main.css" rel="stylesheet">
and that should translate it as
<link href="/css/main.css" rel="stylesheet">
Any help?
thanks

CSS doesn't work with long link in laravel

I have a interesting trouble, in my view I have:
<base href="{{asset('')}}" />
<link href="ad/bower_components/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
that my css's link , it was long but it still worked a month ago, but now it doesn't work, and I try :
<link href="{{ URL::asset('ad/bower_components/bootstrap/dist/css/bootstrap.min.css') }}" rel="stylesheet">
too, but it haven't worked yet,
but when I try a shorter link, it works normally, so why?
<link href="{{asset('link_to_css_file_in_public_folder')}}" rel="stylesheet" >
That should work.
Ps: put this code in your layouts->app.blade.php or any other layout you use.
in case you want to load separate css file in different pages in your layout call this #yield('styles') and then in your blade import your css file like my sample above inside
#section('styles')
your_code
#endsection
<link rel="stylesheet" href="{{URL::to('/')}}/asset/ad/bower_components/bootstrap/dist/css/bootstrap.min.css">
is your asset folder in public folder or not?..if it then it works

Can't load CSS in Laravel

Hi I am currently learning Laravel and seem to be having issues loading custom CSS that is located in the public/css/bootstrap.css.
I have been attempting to load it via
<link href="{{ asset('css/bootstrap.css') }}" rel="stylesheet" type="text/css" >
But it is if the CSS is not getting picked up. When I view the page source (http://portfollo.co.uk/css/bootstrap.css) I just get an error. Any ideas ?
Try with public/css/bootstrap.css
<link href="{{ asset('public/css/bootstrap.css') }}" rel="stylesheet" type="text/css" >
OR
<link href="'/css/bootstrap.css'" rel="stylesheet" type="text/css" >
You should put your css file inside public folder, (app/public):
then in your head:
<link rel="stylesheet" href="{{ url('/') }}/style.css" type="text/css"/>
Public folder will contain all css and js files, you can also create assets folder inside public folder and then point to correct path:
<link rel="stylesheet" href="{{ url('/') }}/assets/css/style.css" type="text/css"/>
change name as public/css/bootstrap.css and put css in that folder. and give the same path.
This is not a CSS error. its Routing error. check your route.php file just check your source code like this view-source:http://portfollo.co.uk/css/bootstrap.css
you are trying something wrong ??

How to refer to css file in codeigniter?

I use XAMPP and CI 2.14
(I know it's sounds ridiculous, but...) I don't know how to refer to a css file from a view. I've read and tried a lot of examples but, obviously I do something wrong...
<link rel="stylesheet" href="<?php echo base_url();?>css/main.css" type="text/css" />
The base url is: http://localhost/myapp/
Where should I put then main.css file (now is in the webroot/myapp/css folder), and how to reference it from a codeigniter view?
create folder assets:
path is: /assets/css/your_file.css
<link rel="stylesheet" href="/assets/css/your_file.css" type="text/css" />
Try to put the css folder inside the application folder, like this:
/yourapp/application/css/
And then
<link rel="stylesheet" href="<?php echo base_url();?>application/css/main.css" type="text/css" />

Categories