igaster / laravel-theme

Theme support for Laravel
MIT License
520 stars 113 forks source link

Theme::css - strange output #71

Closed rafailml closed 7 years ago

rafailml commented 7 years ago

Hi there! First thank you for the project. Very useful, but I have a problem:

My blade code is:

<!DOCTYPE html>
<html lang="en">
<head>
    <title>Title</title>
    {{ Theme::css("css/style.css") }}

</head>
<body>
</body>
</html>

And browser (Safari) shows:

<html lang="en">
<head>
    <title>Title</title>
    <style></style>
</head>
<body>
    "<link media="all" type="text/css" rel="stylesheet" href=""> "
</body>
</html>

Somehow it puts the output in the body as text and also notice that href is empty.

What I'm doing wrong?

igaster commented 7 years ago

Hello @rafailml,

This is a strange behaviour. You may try to rebuild your blade cache with artisan view:clear and check again. What version of the package are you using? (Use composer show to get installed packages versions).

rafailml commented 7 years ago

Same result after artisan view:clear . But this morning I have href="/css/style.css" Package version is: igaster/laravel-theme v2.0.4 Laravel: 5.4 with Spark MAMP Pro, apache PHP: 7.0.20

igaster commented 7 years ago

You should use the {!! Theme::css("css/style.css") !!} syntax. You do not want to escape the html code. This is probably the reason that safari moves it to the body...

rafailml commented 7 years ago

Thanks @igaster !!! That's working.

igaster commented 7 years ago

:-)

Updated the docs to make it clear!