PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Sunday, January 30, 2022

[FIXED] Load css/js files in Laravel 4 with Composer?

 January 30, 2022     composer-php, laravel, laravel-4     No comments   

Issue

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.


Solution

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')



Answered By - Barryvdh
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing