Using CSS in Laravel views? Using CSS in Laravel views? laravel laravel

Using CSS in Laravel views?


Put your assets in the public folder; e.g.:

public/csspublic/imagespublic/fontspublic/js

And then, to access them using Laravel, use:

{{ HTML::script('js/scrollTo.js'); }}{{ HTML::style('css/css.css'); }}

Or:

{{ URL::asset('js/scrollTo.js'); }}{{ URL::asset('css/css.css'); }} 

This syntax will automatically generate the correct path (e.g., `public/js/scrollTo.js').


your css file belongs into the public folder or a subfolder of it.

f.e if you put your css in

public/css/common.css

you would use

HTML::style('css/common.css');

In your blade view...

Or you could also use the Asset class http://laravel.com/docs/views/assets...


You can also write a simple link tag as you normaly would and then on the href attr use:

<link rel="stylesheet" href="<?php echo asset('css/common.css')?>" type="text/css"> 

of course you need to put your css file under public/css