I am Using Laravel 5.0 , the Form and Html Helper are removed from this version , i dont know how to include external css and js files in my header file. Currently i am using this code.
<link rel="stylesheet" href="/css/bootstrap.min.css"> <!--- css file ---> <script type="text/javascript" src="/js/jquery.min.js"></script>
To include an external JavaScript file, we can use the script tag with the attribute src . You've already used the src attribute when using images. The value for the src attribute should be the path to your JavaScript file. This script tag should be included between the <head> tags in your HTML document.
I think that the right way is this one:
<script type="text/javascript" src="{{ URL::asset('js/jquery.js') }}"></script>
Here I have a js
directory in the laravel's app/public
folder. There I have a jquery.js
file. The function URL::asset() produces the necessary url for you. Same for the css:
<link rel="stylesheet" href="{{ URL::asset('css/somestylesheet.css') }}" />
Hope this helps.
Keep in mind that the old mehods:
{{ Form::script() }}
and
{{ Form::style() }}
are deprecated and will not work in Laravel 5!
Try it.
You can just pass the path to the style sheet .
{!! HTML::style('css/style.css') !!}
You can just pass the path to the javascript.
{!! HTML::script('js/script.js') !!}
Add the following lines in the require section of composer.json file and run composer update "illuminate/html": "5.*".
Register the service provider in config/app.php by adding the following value into the providers array:
'Illuminate\Html\HtmlServiceProvider'
Register facades by adding these two lines in the aliases array:
'Form'=> 'Illuminate\Html\FormFacade', 'HTML'=> 'Illuminate\Html\HtmlFacade'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With