Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript Gulp Basics Improving your Gulp Task Pipelines The Build and Development Pipeline

Albert Boehm
Albert Boehm
5,878 Points

Instead of adding gulp.start("clean") to the default task callback,can we make "clean" a dependency of the "build" task?

If so, do these methods differ in any way? Does one of them have any advantages or disadvantages over the other?

Thank you :-)

1 Answer

Neil McPartlin
Neil McPartlin
14,662 Points

Based on my understanding so far, I'd say the answer is no, or not easily. In the video, the build task is written so that both 'minifyScripts' and 'compileSass' could start at the same time EXCEPT 'minifyScripts' must wait until 'concatScripts' has finished.

Now all 3 of these tasks create files that would be deleted by 'clean', so somehow 'clean' must run before any of these 3 tasks run. Making all 3 dependent on 'clean' will not work, because all 3 do not start together and even if they did, clean may run 3 times I guess.

If we could get this working, we would still need to type 'gulp build' whereas as Huston says, the goal is for us to just need to use the default option so that all we need to type is 'gulp'.