TL;DR: What is the correct way to link to a stylesheet in Laravel 5?
Background: I'm using the dev version of Laravel 4.3 (5) because I want to use Socialite, and it makes sense to develop with that from the start. I am having a problem getting templates transferred from 4.2
I've moved my blade layout files to the new directory structure (resources/templates) and placed my CSS in the public/css/ folder.
When I load my route /test/ all I get is "Whoops, looks like something went wrong."
For testing purposes I've removed all blade layout syntax from my layouts - the raw HTML works, but there is no styling (as there is no linked stylesheet). That tells me the routes, views and controllers work.
The problem:
In my layouts, if I remove the following, the layouts work:
{{ HTML::style('css/bootstrap.min.css') }}
{{ HTML::style('css/style.css') }}
Question:
What is the correct location and syntax for Blade Stylesheet inclusion in Laravel 5 and what I should be using instead?
If you want to use plain HTML then use like this-
Adding to @joseph's answer, for the users preferring not to switch to the new syntax, you can use
and continue with the old syntax . this can be set almost anywhere, but a better choice would be a service provider, say legacy service provide for l4 . you can find further discussion on this at laracasts, where you can find taylor otwells thoughts on this .
The
HtmlBuilder
has been removed from Laravel's core, soHTML::style()
is no longer available.If you want to use it in laravel 5, add the following to your
composer.json
file, under therequire
key:Also note, since
HTML::style()
returns HTML code, you don't want it escaped. Use the raw brackets: