Trigger Gulp when building
It would be nice to trigger a Gulp task when you run "ionic build ios/android". I think it would be a cool feature to be able to do some work on the deployed files before it builds for a specific platform.
My problem with this: If we add a pre-build-gulp hook, why don't we add a pre-build hook for shell scripts too? And everything else.
The CLI already has tons of features. Can't you just make a shell script?
# build.sh
gulp pre-build
ionic build ios
Boom!
@ajoslin I think your suggestion is a good workaround. Although, Since gulp is a part of ionic and performs steps related to the build such as SASS processing I agree with the author. I think it should be supported in the build command.
I agree with @adamduren, if we're going to have 'gulpStartupTasks' be an option then we should have options for all well-known steps (https://docs.npmjs.com/misc/scripts).
@ajoslin's solution, while fine for a 'pre-build' script, is insufficient for complex tasks when using 'watch', and can result in race conditions and non-deterministic build scenarios depending on the length of tasks being performed. I use browserify with watch and live-reload when I develop, and there's no clean way to integrate it with the current setup, from what I can see.
My opinion is that the 'serve' command should use the generated gulp file for dev tasks, so that the user can customize it as needed.
It's a bit convoluted, but here's my approach:
- ionic.project: gulpStartupTasks:
["watch"] - gulpfile.js: watch: set pattern to include source files and exclude dist/build files (and exclude vendor files)
- ionic.project: watchPatterns: set pattern to only include dist/build files
So live-reload still works, etc.
Thanks for opening the issue. It seems that issue has been resolved. I am going to close this issue but please feel free to reopen another issue if this occurs again.