5

I want to include CSS and Javascript with the help of Laravel 5 helper. But I don't know which is there.

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

I need to load with the helper of laravel. Not to traditional.

Please any suggestion tell me.

2 Answers 2

1

In Laravel you can use the provided HTML class for including the CSS and JS in a project

Stylesheet:

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

Javascript:

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

NOTE:

You can also use 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

Sign up to request clarification or add additional context in comments.

4 Comments

But any helper class for that .i want to helper class.I am learning laravel 5
look at the url provided for your help if you are using laravel 5
But i want to load within one array all my css file name and js also
For that you have to autoload libraries, checkout this link stackoverflow.com/questions/17584810/…
0

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

For using {{ HTML::style('css/style.css') }}, you will have to go through following steps:

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'

1 Comment

But i want to load within one array all my css file name and js also

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.