Working with scripts and style sheets in Laravel 5.1

1

I'm new to Laravel 5.1 (actually Laravel) and I'm having a hard time understanding how to work with style sheets and simple scripts. On several sites, I see that I need to add an element in my composer.json which is "laravelcollective/html": "~5.0" but in others I have already found saying that working this way is already outdated for version 5.1

Does anyone have a good tutorial (in Portuguese) that gives me this light and that does not leave the initial scope of laravel 5.1?

    
asked by anonymous 01.12.2015 / 17:09

2 answers

4

Assuming:

public/css 
public/js

You can do the following:

<link href="{{ asset('css/aqr.css') }}" media="all" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="{{ asset('js/aqr.js') }}"></script>

or:

{{ HTML::script('js/aqr.js'); }}

{{ HTML::style('css/aqr.css'); }}

However to use the second option you need to install Illuminate / HTML, follow the link .

    
01.12.2015 / 18:13
1

Helping you a little more, do this:

<link href="{!! asset('css/aqr.css') !!}" media="all" rel="stylesheet" type="text/css" />

<script type="text/javascript" src="{!! asset('js/aqr.js') !!}"></script>

In this way you will be using the new syntax for the blade in laravel 5.1, remembering that the old syntax:

{{ }}

It is deprecated and will soon be removed, so always use the new one:

{!! !!}
    
02.12.2015 / 14:06