Search code examples
phplaravellaravel-5laravel-elixir

Laravel Elixr copy method not working


I am trying to copy some js files, using elixr, from my vendor/bower_components folder, but when running gulp they don't copy across.

elixir(function(mix) { mix.less('app.less')
  .copy('underscore/underscore.js', 'public/js/vendor/underscore.js'); });

No error is given by gulp.

[14:12:58] Using gulpfile ~/Public/balloonprinting_l5/gulpfile.js
[14:12:58] Starting 'default'... 
[14:12:58] Starting 'less'... 
[14:12:58] Running Less: resources/assets/less/app.less 
[14:12:59] Finished 'default' after 506 ms 
[14:13:00] gulp-notify: [Laravel Elixir] Less Compiled! 
[14:13:00] Finished 'less' after 1.74 s 
[14:13:00] Starting 'copy'... 
[14:13:00] Finished 'copy' after 2.86 ms

Solution

  • You need to specify full source path:

    elixir(function(mix) { mix.less('app.less')
      .copy(
        'bower_components/underscore/underscore.js', 
        'public/js/vendor/underscore.js'
      ); 
    });
    

    As you can see I added bower_components/ to source path, this is default bower packages folder.