Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
6 views

Laravel 5.6 Unable To Import Css File - Stack Overflow

Uploaded by

filmazy
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Laravel 5.6 Unable To Import Css File - Stack Overflow

Uploaded by

filmazy
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

6/11/24, 6:33 PM Laravel 5.

6 unable to import css file - Stack Overflow

2024 Developer survey is here and we would like to hear from you! Take the 2024 Developer Survey

Laravel 5.6 unable to import css file


Asked 6 years, 1 month ago Modified 6 years, 1 month ago Viewed 2k times

I am trying to import css file but i just cant.

my css file is in "public/css/style.css"


0
i ve tried all possible combinations that i found on internet but nothing works

<link href="/css/style.css" rel="stylesheet">


<link href="{!! asset('css/style.css') !!}" media="all" rel="stylesheet"
type="text/css" />
<link rel="stylesheet" href="{{ URL::asset('css/style.css') }}" />

Laravel .htaccess

<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>

RewriteEngine On

# Handle Authorization Header


RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

# Redirect Trailing Slashes If Not A Folder...


RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]

# Handle Front Controller...


RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>

but nothing just works for me

css laravel

Share Improve this question Follow edited Apr 29, 2018 at 5:17 asked Apr 28, 2018 at 16:37
JGeorgeJ
333 1 9 26
https://stackoverflow.com/questions/50078776/laravel-5-6-unable-to-import-css-file?noredirect=1&lq=1 1/3
6/11/24, 6:33 PM Laravel 5.6 unable to import css file - Stack Overflow

3 Answers Sorted by: Highest score (default)

<link href="{!! asset('css/style.css') !!}" media="all" rel="stylesheet"


type="text/css" />
2
Change That to This

<link href="{{ asset('css/style.css') }}" media="all" rel="stylesheet"


type="text/css" />

and it should work.

Share Improve this answer Follow answered Apr 28, 2018 at 19:58
Mahbod_SN
61 1 5

If this doesn't work, then make sure that you have properly set up your .htaccess (for apache) or your
nginx config. – Namoshek Apr 28, 2018 at 20:35

No it doesnt work and this is my laravel .htaccess. How can i check if my .htacces is set properly.
– JGeorgeJ Apr 29, 2018 at 5:17

stackoverflow.com/questions/40682748/… this wont work too – JGeorgeJ Apr 29, 2018 at 5:34

Solved

i ma probably missing some configuration that i cant find out. But i create virtual host with
1
xampp and set DocumentRoot "C:\xampp\htdocs\final\public" and this works.

Thanks for help guys.

Share Improve this answer Follow answered Apr 29, 2018 at 6:16
JGeorgeJ
333 1 9 26

https://stackoverflow.com/questions/50078776/laravel-5-6-unable-to-import-css-file?noredirect=1&lq=1 2/3
6/11/24, 6:33 PM Laravel 5.6 unable to import css file - Stack Overflow

Try:

<link href="./public/css/style.css" rel="stylesheet">


0
The ./ part is the current folder you are in.

Share Improve this answer Follow answered Apr 28, 2018 at 17:41
matthunterking
1

it does not work. this localhost:8000/public/css/style.css and this localhost:8000/css/style.css shows up 404
error – JGeorgeJ Apr 28, 2018 at 17:59

How about mix.less('resources/assets/less/app.less', 'public/css');? Found it on


laravel.com/docs/5.6/mix#working-with-stylesheets. – matthunterking Apr 28, 2018 at 18:13

https://stackoverflow.com/questions/50078776/laravel-5-6-unable-to-import-css-file?noredirect=1&lq=1 3/3

You might also like