Laravel 5 Library for loading CSS, JavaScript

I want to enable CSS and Javascript using the Laravel 5 helper. But I don't know what it is.

href="{{ url() }}/assets/css/bootstrap.css" rel="stylesheet" 

I need to download the laravel helper. Not traditional.

Please tell me some suggestion.

+5
source share
2 answers

In Laravel, you can use the provided HTML class to include CSS and JS in your project.

Styles:

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

JavaScript:

 {{ HTML::script('js/your_js_file.js') }} 

Note:

You can also use the URL class

Js

{{ URL::asset('js/your_js_file.js'); }}

STYLE

 {{ URL::asset('css/style.css'); }} 

EDIT:

If you are using LARAVEL 5 , find the solution here http://laravel.io/forum/09-20-2014-html-form-class-not-found-in-laravel-5

+1
source

One way: URL::asset('css/file.css');

To use {{ HTML::style('css/style.css') }} you will need to follow these steps:

Add the following lines to the require section of the composer.json file and run the composer update "illuminate / html": "5. *".

Register the service provider in config / app.php by adding the following value to the providers array:

'Light \ Html \ HtmlServiceProvider'

Register facades by adding these two lines to an array of aliases:

'Form' => 'Illuminate \ Html \ FormFacade',

'HTML' => 'Illuminate \ Html \ HtmlFacade'

0
source

All Articles