php - How to link external CSS and Script (assets) in Laravel 5.1 project -


hi guys new laravel , first project in laravel, had trouble linking assets(css & js) file on views.. did research found if use {{url::asset('assets/plugins/bootstrap/css/bootstrap.min.css')}} in laravel 5.1 work. did succeed when single link, when add other links..

<link rel="stylesheet" href="{{url::asset('assets/plugins/animate.css')}}"> <link rel="stylesheet" href="{{url::asset('assets/plugins/line-icons/line-icons.css')}}"> <link rel="stylesheet" href="{{url::asset('assets/plugins/parallax-slider/css/parallax-slider.css')}}"> <link rel="stylesheet" href="{{url::asset('assets/css/custom.css')}}"> 

the server denied access files in assets folder access forbidden!. .htaccess file code is..

<ifmodule mod_rewrite.c> <ifmodule mod_negotiation.c>     options -multiviews </ifmodule> rewriteengine on  # redirect trailing slashes if not folder... rewritecond %{request_filename} !-d rewriterule ^(.*)/$ /$1 [l,r=301]  # handle front controller... rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewriterule ^ index.php [l] </ifmodule> 

question if .htaccess file had problem why when put 1 asset link accept? or proper way of linking files? using xampp local server. *guy learned laravel yesterday easy on me... in advance

you can use laravel blade template method

{!! html::style('css/style.css') !!}  {!! html::script('js/script.js') !!} 

note :you should add css files public folder means in example public/css folder. same applied jquery files also.

also can add following way if using online links

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script> 

or else

<link rel="stylesheet" href="{{ url::asset('css/style.css') }}" /> <script type="text/javascript" src="{{ url::asset('js/jquery.js') }}"></script> 

Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -