In Laravel 4.2, I used public folder to store all my CSS, JS, images and uploads. Currently, there's a new resources folder with assets folder in it coming with Laravel 5.0 installation:
/public
/resources/assets
This is confusing to me, especially because resources also holds views in it.
Via Laravel's upgrade guide (4.2 to 5.0):
Copy your application's public assets from your 4.2 application's public directory to your new application's public directory.
and further:
You may move your Sass, Less, or CoffeeScript to any location you wish. The resources/assets directory could be a good default location.
Question: What is the actual difference between public and resources folders in Laravel 5.0 folder structure?
Laravel elixir, by default uses the /resources/assets folder as the base directory for scripts to be compiled, minified and so on. So you should put your raw sass, less, coffeescript, js and css files in there to let elixir do it's work. A good place for the files you are using is the public folder.
When working this way, you can have all your files concatenated and minified with gulp and less effort. Simply include them from your public folder.
You can think of them as being separate folders for development and production. In resources you have all your development files that'll not ship off into production (SASS, Coffeescript, Babel, Jade, etc). But when they're compiled (or piped through something like Gulp) you can configure them to output to public, the production folder.
The big difference here is that everything in
public
is... well public.resources
aren't. What you put in where is up to you.Generally you would have everything the browser needs to access directly in the public directory. Which usually means: JavaScript, CSS, images, maybe some videos or audio files.
resources/assets
is meant for things that have to be compiled or minified first. So you would have a few LESS or SASS files inresources/assets
and they would get compiled and minified into one CSS file that's put in thepublic
directory.In laravel public folder is best for Image, CSS, and Javascripts. In public folder we can use for uploaded images, videos, text files etc.