Include custom CSS

Published 5 months ago by screwtape_mk

Hi I dont understand how come link 1 works and link 2 doesnt work. They the same file

link 1:

http://spanibox.com/css/app.css

link 2:

http://spanibox.com/css/custom.css

I used:

Im using laravel 5.0

jcphpdev

have you put your custom.css file in public/css/ ?

Cronix
Cronix
5 months ago (790,130 XP)

Are you actually loading the css file in your template? If so, how?

ejdelmonico

All messages in the console and Laravel generics are 404. I looked at your links and the only thing that seems a likely candidate is the file is simply not in the public/css/ directory or the file name is different than what is in your link.

screwtape_mk

Thanks all for your assistance so far

my file custom.css is in public/css right next to app.css. I am loading them both on to a default.blade.php file which is then extended by the home.blade.php which is what you see here : http://spanibox.com/

view page source to see it:

I used this to load them:

{{asset('css/custom.css') }} {{asset('css/app.css') }}

I have double checked spellings too many times

Cronix
Cronix
5 months ago (790,130 XP)

I viewed the source of spanibox.com and checked both app.css and custom.css files.

<link rel="stylesheet" type="text/css" href="http://spanibox.com/css/custom.css"/>
<link rel="stylesheet" type="text/css" href="http://spanibox.com/css/app.css"/>

If I click on the custom.css file and view the source, it's a html page for a 404 error. So, something is not right on your end. app.css produces a valid css file.

Are you sure /public/css/custom.css actually exists in that path and you're not looking in /resources?

screwtape_mk

i wish i could take a screenshot and show you. thts exactl where the file is public/css/custom.css

Vilfago

It will not resolve your issue, but it could be better to load the custom.css after the app.css. This way your custom settings are not overrided by the app settings.

And for your issue... I had the same settings on my site, with same filename, and it's work great.

So maybe yes, a screenshoot. We will maybe see something strange.

screwtape_mk

i really have no idea whats going on- im using laravel version 5.0.16; what i dont get is why is the one file loading while the other doesnt...i imagine no need to create routes since there isn't a route for the working app.css

screwtape_mk
jcphpdev

Can you show us the route files?

joshuafranks

This may not help at all, but perhaps try clearing your application cache (php artisan cache:clear) and restarting your server.

screwtape_mk

I followed this 2min video when setting up laravel

https://www.youtube.com/watch?v=18YV_1kOJBk&list=PLfdtiltiRHWGGxaR6uFtwZnnbcXqyq8JD&index=4

I hope i didnt break anything

screwtape_mk

SOLVED:

So during my laravel set up i had attempted an installation of another script and underwent issues - i now have 2 folders:

public

and

public_html...thats where i must place the custom.css file and not in the first folder...apologies and thanks to all you guys for your prompt responses

Cronix
Cronix
5 months ago (790,130 XP)

I have a feeling you're going to be having other issues with that.

screwtape_mk

most probably - is it the .htaccess file?

Please sign in or create an account to participate in this conversation.