FabricioG
FabricioG

Reputation: 3320

Load bootstrap with laravel default

I'm sure I'm missing something here but not sure what. According to the Laravel documentation:

Laravel's package.json file includes the bootstrap package to help you get started

According to the instructions:

Before compiling your CSS, install your project's frontend dependencies using

Following this I run npm install then I run npm run dev From here I test it out using a simple form in a blade file called 'options.blade.php In my blade file I load assets like so.

<script type="text/javascript" src="{{url('assets/js/app.js')}}"></script>
<link rel="stylesheet" href="{{url('assets/css/app.css')}}">

My expected results would be that the bootstrap css would be usable "right out of the box". The layout appears with no css style loaded. I can confirm public/css/app.css and public/js/app.js exists.

This is specifically related to using bootstrap as Laravel says preset. I know how to add the css links from cdn or local if needed but wanted to do it out of the box with Laravel.

Upvotes: 0

Views: 1434

Answers (1)

ceejayoz
ceejayoz

Reputation: 180024

Simple answer: you're giving url() the wrong paths.

If your assets are public/css/app.css and public/js/app.js, you want:

<script type="text/javascript" src="{{url('js/app.js')}}"></script>
<link rel="stylesheet" href="{{url('css/app.css')}}">

(You may want to use asset() instead of url() here, too. See In Laravel 5, What's the difference between {{url}} and {{asset}}? for details.)

Upvotes: 2

Related Questions