Gammer
Gammer

Reputation: 5608

Laravel 5 Routing to CSS folder issue

I have the following route which loads the page but the css of the page doesn't loads.

Route::get('admins', function () {
        return view('admins/index');
});

In the contrast the following route loads the same page but here I added index and the page loads correctly. but I also adds index with admins in the browser address bar.

Route::get('admins/index', function () {
        return view('admins/index');
});

I am calling css files in the views like:

<link href="../assets/css/animate.min.css" rel="stylesheet" />

I searched for the solutions but didn't got anything.

Upvotes: 0

Views: 2328

Answers (2)

Mech
Mech

Reputation: 79

i am using code like below for css and js :

<link rel="stylesheet" href="{{ asset('/') }}css/menu-style.css">

And css directory is in my "project/public" directory.

Upvotes: 1

Drudge Rajen
Drudge Rajen

Reputation: 7987

For Laravel 4 & 5:

<link rel="stylesheet" href="{{ URL::asset('assets/css/animate.min.css') }}">

URL::asset will link to your project/public/ folder, so chuck your scripts in there.

Note: You'll need to be using blade templates to use this. All Blade templates should use the .blade.php extension.

Upvotes: 2

Related Questions