Sojan Jose
Sojan Jose

Reputation: 3238

Laravel 5 issues with linking css assets

am currently trying to port my laravel 4 application to laravel 5 . i have added "illuminate/html": "5.*" to composer and also the facade and service providers to config. i was using the following syntax to link to my css files

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

but in laravel 5 , my views output is all broken , with the page displaying like the below screenshot .

laravel blade issue.

what could i be missing here ? is there any changes to the blade syntax in laravel 5 ?

Upvotes: 7

Views: 27904

Answers (5)

Anshu Shekhar
Anshu Shekhar

Reputation: 341

If you want to use plain HTML then you can also use it like this-

    <link rel="stylesheet" href="/css/style.css">

Upvotes: 0

jaahvicky
jaahvicky

Reputation: 448

Change your code to the below

{!! Html::style( asset('css/bootstrap.min.css')) !!}
{!! Html::style( asset('css/style.css')) !!}

Upvotes: 3

Ritchie
Ritchie

Reputation: 408

<link href="{{ asset("assets/css/style.css") }}" rel="stylesheet">

Upvotes: 4

Sojan Jose
Sojan Jose

Reputation: 3238

found the answer here on this thread and here . on the second thread Taylor Otwell gives the answer himself . In laravel 5 , the laravel 4 default syntax {{ code }} , will escape the data output . if you want unescaped html data, you have to use the new syntax

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

if you want to revert to previous syntax you can use

Blade::setRawTags('{{', '}}');

Upvotes: 11

Yousof K.
Yousof K.

Reputation: 1404

  1. Check if the assets are there, and are being linked properly.
  2. check permission and set chmod to 777 (Unix).
  3. If that doesn't work, use <link rel="stylesheet" type="text/css" href="{{asset('relative/to/public/folder.css')}}" > manually.

Upvotes: 6

Related Questions