Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Francis N
10,376 PointsWhat is the purpose of gulp serve if the dependency is watchFiles?
I noticed that in the Gulp Basics Stage 4 Video 4, we write a 'serve' task with 'watchFiles' as its dependency. What is the purpose of this? Why can't we just use 'gulp watch'?
//Watch Task
gulp.task('watchFiles', function() {
gulp.watch('scss/**/*.scss', ['compileSass']); //(if other tasks dont depend on a given task, then you dont need to 'return' anything like on Line 13,25,33)
gulp.watch('js/main.js', ['concatScripts']);
});
//Serve Task
gulp.task('serve', ['watchFiles']);
1 Answer
Brody Chen
11,252 PointsI think 'serve' could be a more general task than 'watchFiles', which means you can do more stuff inside 'serve'.
Although based on this video, 'serve' is actually the same as 'watchFiles'.
Hope this helps :)