I-AM-OBODO Posted September 6, 2015 Share Posted September 6, 2015 Hi all. No matter what i tried my links just wont work on my laravel app. My css folder is in the public folder. public/css. I dunno what is wrong. I installed laravel with composer and i am running windows 7 and wamp. this is the link i used: <link rel="stylesheet" href="{!! asset('css/bootstrap.min.css') !!}"><link rel="stylesheet" href="{!! asset('css/styles.css') !!}"> Thanks Quote Link to comment Share on other sites More sharing options...
scootstah Posted September 6, 2015 Share Posted September 6, 2015 What URL is it trying to load? Look in the network tab on Chrome Developer Tools. Quote Link to comment Share on other sites More sharing options...
I-AM-OBODO Posted September 6, 2015 Author Share Posted September 6, 2015 (edited) What URL is it trying to load? Look in the network tab on Chrome Developer Tools. On the network tab in chrome it's not showing any url at all. just blank but on view source localhost/laravel/index localhost/laravel/css/styles.css localhost/laravel/css/bootstrap.min.css localhost/laravel/css/bootstrap-theme.min.css localhost/laravel/js/bootstrap.min.js again i noticed it has 8 error notifications and when i checked, i saw that the path to my styles is not seen: Failed to load resource: the server responded with a status of 404 (Not Found) what could be wrong. but when i load the bootstrap style from the cdn, it works perfectly!! Edited September 6, 2015 by Mr-Chidi Quote Link to comment Share on other sites More sharing options...
scootstah Posted September 6, 2015 Share Posted September 6, 2015 If your assets are in public/css, and it's only loading css, then it looks like you should change the asset path to include public. <link rel="stylesheet" href="{!! asset('public/css/bootstrap.min.css') !!}"> <link rel="stylesheet" href="{!! asset('public/css/styles.css') !!}"> Quote Link to comment Share on other sites More sharing options...
I-AM-OBODO Posted September 6, 2015 Author Share Posted September 6, 2015 If your assets are in public/css, and it's only loading css, then it looks like you should change the asset path to include public. <link rel="stylesheet" href="{!! asset('public/css/bootstrap.min.css') !!}"> <link rel="stylesheet" href="{!! asset('public/css/styles.css') !!}"> Tried it as well but to no avail Quote Link to comment Share on other sites More sharing options...
scootstah Posted September 7, 2015 Share Posted September 7, 2015 So if you point your browser to localhost/laravel/public/css/styles.css, it doesn't work? Can you post your directory structure? Quote Link to comment Share on other sites More sharing options...
I-AM-OBODO Posted September 7, 2015 Author Share Posted September 7, 2015 (edited) My directory structure app - Console -Events - Exeptions - Http - Jobs - Listeners - Policies - Providers -- user bootstrap - cache -- app -- autoload config -- app -- auth -- broadcasting -- cache -- compile -- database -- filesystems -- mail -- queue -- services -- session -- view database - factories - migrations - seeds public - css - fonts - js -- htaccess -- favicon -- index -- robots resources - assets - lang - views storage - app - framework - logs tests - ExampleTest - TestCase vendor - so many folders Edited September 7, 2015 by Mr-Chidi Quote Link to comment Share on other sites More sharing options...
I-AM-OBODO Posted September 7, 2015 Author Share Posted September 7, 2015 So if you point your browser to localhost/laravel/public/css/styles.css, it doesn't work? Can you post your directory structure? My directory structure app - Console -Events - Exeptions - Http - Jobs - Listeners - Policies - Providers -- user bootstrap - cache -- app -- autoload config -- app -- auth -- broadcasting -- cache -- compile -- database -- filesystems -- mail -- queue -- services -- session -- view database - factories - migrations - seeds public - css - fonts - js -- htaccess -- favicon -- index -- robots resources - assets - lang - views storage - app - framework - logs tests - ExampleTest - TestCase vendor - so many folders Quote Link to comment Share on other sites More sharing options...
I-AM-OBODO Posted September 7, 2015 Author Share Posted September 7, 2015 So if you point your browser to localhost/laravel/public/css/styles.css, it doesn't work? Can you post your directory structure? it works by point with the above uri Quote Link to comment Share on other sites More sharing options...
scootstah Posted September 7, 2015 Share Posted September 7, 2015 Okay, so check the network tab after adding public/ and see what URL it is now trying. Quote Link to comment Share on other sites More sharing options...
jiros1 Posted December 8, 2015 Share Posted December 8, 2015 If your CSS files are not loaded properly then Laravel doesn’t know where to look for them.To let Laravel know where your CSS file is located you’ll need to set a direct path in your blade file: {!! HTML::style('_asset/css/custom.css') !!} It looks very similar for javascript files: {!! HTML::script('_asset/js/jquery.min.js') !!} If this doesn’t work, or you’ll get an error that the HTML serviceprovider class is missing, you’ll need to install the illuminate/html package.This is how you do it:Add the following line in the require section of composer.json file "require-dev": { "illuminate/html": "5.*", And run composer update.Register the service provider in config/app.php by adding the following value into the providers array: Illuminate\Html\HtmlServiceProvider::class And finally register the facades by adding these two lines in the aliases array: 'Form'=> 'Illuminate\Html\FormFacade', 'HTML'=> 'Illuminate\Html\HtmlFacade' Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.