My gulpfile.js
looks as below. If I execute gulp watch
, the copy task does not get executed on change of app.js
. In fact, if I have the copy task alone, gulp watch
will execute copy once and then exit. What am I doing wrong?
elixir(function (mix) {
mix.scripts(
[
'../../../bower_components/angular/angular.js'
]
).copy('resources/assets/js/app.js', 'public/js/app.js')
});
In order for Elixir to watch all the files inside the assets
folder you need to instruct it where to look for additional resources. For that you simply need to use the registerWatcher
method.
Unfortunately Laravel documentation leaves a lot to desire so this option is often overlooked because it's not properly documented.
elixir.config.registerWatcher("default", "resources/assets/**", null);
elixir(function (mix) {
mix.scripts(
[
'../../../bower_components/angular/angular.js'
]
).copy('resources/assets/js/app.js', 'public/js/app.js')
});