How to include External CSS and JS file in Laravel 5

后端 未结 14 1775
庸人自扰
庸人自扰 2020-11-30 19:18

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 usin

14条回答
  •  攒了一身酷
    2020-11-30 19:25

    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'

提交回复
热议问题