What files of Laravel Elixir are necessary on production server? What files of Laravel Elixir are necessary on production server? laravel laravel

What files of Laravel Elixir are necessary on production server?


You don't have to worry about including any files from the node_modules directory; you can think of those as dependencies similar to the vendor directory for your php project.

You'll just need to include the files in the public/* directory in order to have working views if you are using the default paths and configuration for compiling assets. You can see a good example of this in the Scripts section of the Elixir documentation.

The scripts method assumes all paths are relative to the resources/assets/js directory, and will place the resulting JavaScript in public/js/all.js by default:

elixir(function(mix) { mix.scripts([ 'jquery.js', 'app.js' ]); });

As a side note, I personally wouldn't recommend creating this sort of separation because the project seems heavy. If you have a very large project size, it most likely shouldn't be due to css and js. You can also consider using a cdn to lighten the production space if needed.


I've run into the same problem. My gulpfile.js has

mix.sass('app.scss');mix.browserify('app.js');mix.version(['css/app.css', 'js/app.js']);

This is my solutions:

  • Option 1: If you have npm and gulp on server. On local machine, donpm shrinkwrap, then push package.json, gulpfile.js, npm-shrinkwrap.json,resources/assets/(js|sass). In server website root, do npm install and gulp --production
  • Option 2: No need npm or gulp on server. Just do gulp --production on local and push public/build/* to server. If Elixir versioning is not used, push public/(js|css) instead. resources/assets(js|css) and all npm gulp stuff can be kept from server.

node_modules is not needed in either case.
I used option 2, much easier and worked fine for me.