Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Load css/js files in Laravel 4 with Composer?

I'm working on creating a new project in Laravel 4. I have a tiny bit of experience in Laravel 3, in which I got used to the assets system. I'm now having a lot of trouble figuring out how to load CSS and JS files in the new system.

I believe I should be using Composer PHP, but I'm not sure how. Where do I put the actual .css and .js files? And then how do I load them with Composer to be utilized in the Laravel project?

I know there are outside plugins like Best Asset, etc. that are written to replicate the Assets system of Laravel 3, but I was hoping to understand the new system and not have to use an outside plugin.

Any help? Thanks.

like image 963
Jakemmarsh Avatar asked Apr 06 '13 19:04

Jakemmarsh


1 Answers

You don't need Composer for your css/js assets. You can use assets pretty much the same as with Laravel 3

You can just place them in your public folder and reference them in your views. You can use plain html, or use the HtmlBuilder: HTML::style('style.css') and HTML::script('script.js')

like image 56
Barryvdh Avatar answered Sep 28 '22 10:09

Barryvdh