Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Getting Started with Gulp ??? Second Edition

You're reading from   Getting Started with Gulp ??? Second Edition Automating web development workflows

Arrow left icon
Product type Paperback
Published in Apr 2017
Publisher Packt
ISBN-13 9781787283732
Length 132 pages
Edition 2nd Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
 Maynard Maynard
Author Profile Icon Maynard
Maynard
Arrow right icon
View More author details
Toc

The default task


Our final task is the default task, and it is best considered as the entry point for our gulpfile. The purpose of this task is to gather and execute any tasks that Gulp needs to run by default.

Writing the default task

The default task is the smallest and the most simple task in our gulpfile and will only take up a single line of code. For this task, we only need to provide it with the name default and the tasks we would like to run by default. 

Using Gulp 3.x:

    gulp.task('default', ['styles', 'scripts', 'images', 'watch']);

Using Gulp 4.x:

    gulp.task('default', gulp.parallel('styles', 'scripts', 'images', 'watch'));

After adding the default task, our gulpfile should look like this:

This code will run each of our tasks once, including our watch task. The watch task will continuously check for changes to our files after the initial round of processing is complete and re-run each of our tasks when the related files change.

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at £13.99/month. Cancel anytime
Visually different images