There are 2 places where I can store javascripts: resources/assets/javascripts
and public/js
.
If we put the files in resources/assets/javascripts
, we should add gulp tasks to copy them. And this is a weakness of this method. And we will need path mapping in browser debugger.
If we put these files in public/js
, we will have our source JS and compiled JS in one place and they will be messed up.
So, where should I store JS in Laravel 5?
The "Laravel-5" answer is to put them in resources/assets/javascripts
. Then you use Laravel-Elixer, which is the new npm
package from Taylor + Jeffrey Way that handles the entire asset management for you using gulp.
Using Laravel-Elixer, you can publish, combine, minifiy and version control all your css + js assets in a simple workflow.
Elixer does alot more - you can read about it here: https://github.com/laravel/elixir
Jeffrey Way has also done a whole Laracast series on it (which I think this series is free): https://laracasts.com/index/elixir
Found my old question and decided to answer myself.
In 2018 it's better to split the system into many separate projects: backend, frontend, iOS app, Android app, etc.
And each app may have its own build system, directory structure, etc.