Add a hook to ionic serve's livereload

Is there a way to add a hook so that I execute a gulp command everytime a file is changed? I know that when running “ionic serve”, the browser will refresh with each changed file, but I want to execute a couple commands after each save. I’m not sure where to start. Any ideas?

Sure can, if you run ionic setup sass, which just sets up sass and downloads some node stuff.

After that we have a global gulp command, "gulpStartupTasks", where you can pass your command. You would just have to write some gulp tasks in the gulpfile.js, but you can use things like shelljs to write shell commands.

Hi @mhartington.

Is this still possible to do?

There is no more ‘ionic setup sass’ command on the current ionic-cli.

I’m trying to execute some tasks from my Grunt before each reload.

Thanks.

1 Like

Is it possible to do this in Ionic cli 3.19? I was able to run an npm task in ionic:watch:before but I need it to run on every reload, when build dev starts again after a change.