Search code examples
angularjslaravelgulplaravel-elixir

Laravel Elixir - adding watch paths


I'm building an Angular application and so have a lot of HTML templates for Angular. My Elixir setup copies these templates into the public folder.

However, I've noticed that the watchers are not triggered when assets are modified (so I don't have to rerun Gulp every time I change a template).

Is there a way in Elixir to register extra folders to be watched for changes? I realise that I could do this by creating an extension that runs Gulp commands to do the copying and then register that extension with a watcher. But since there are already commands in Elixir for copying and registering watchers, it seems crazy to rewrite them.

Even if I have to do it as an extension task, is there a way for me to call existing Elixir tasks from my task?


Solution

  • You can do it using this command:

    elixir.config.registerWatcher("default", "angular/**");
    

    Take a look at this repository, it might help you a lot with your laravel-angular5 setup and make sure to check the gulpfile:
    https://github.com/jadjoubran/laravel5-angular-material-starter