0

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.

4
  • How do you call the css? And where is it located? Any error on developer console log? Commented Feb 1, 2016 at 9:41
  • If that's how you're referring it. You should put your css folder in public/css instead of resources/assets. And set the href to css/animate.min.css. Commented Feb 1, 2016 at 9:52
  • The assets folder is already in the public folder. Commented Feb 1, 2016 at 9:57
  • Post your project structure including admins/index and assets. Or you can just View Page Source and click the link whether it redirects you properly. Commented Feb 1, 2016 at 9:59

2 Answers 2

2

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.

Sign up to request clarification or add additional context in comments.

8 Comments

but the css files are working when i access poject/public/admins/index but does not works when i access poject/public/admins. The index page loads but the css files does not loads.
what you see in the css link when you view the page source while accessing project/public/admins ?
<link href="../assets/plugins/jquery-ui/themes/base/minified/jquery-ui.min.css" rel="stylesheet" />
and in poject/public/admins/index ??
ok i changed the path and the poject/public/admins works fine but now the poject/public/admins/index is not working and the css is not loading.
|
1

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.