How to include External CSS and JS file in Laravel 5

I think that the right way is this one:

<script type="text/javascript" src="https://stackoverflow.com/questions/28104583/{{ 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="https://stackoverflow.com/questions/28104583/{{ 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!

Leave a Comment