{"id":207144,"date":"2015-09-01T06:00:19","date_gmt":"2015-09-01T13:00:19","guid":{"rendered":"http:\/\/css-tricks.com\/?p=207144"},"modified":"2019-11-30T14:47:27","modified_gmt":"2019-11-30T21:47:27","slug":"gulp-for-beginners","status":"publish","type":"post","link":"https:\/\/css-tricks.com\/gulp-for-beginners\/","title":{"rendered":"Gulp for Beginners"},"content":{"rendered":"
Gulp<\/a> is a tool that helps you out with several tasks when it comes to web development. It’s often used to do front end tasks like: <\/p>\n Important Note!<\/strong> This article was written for Gulp 3.x, but now Gulp 4.x is out and recommended. Like any major version change, APIs have breaking changes. If you install Gulp 4 and try to do some of the things in this article, they won’t work. We’ll make some notes of that sprinkled through here to remind you. This looks like a pretty good Gulp 4 starter.<\/a><\/p>\n This is not a comprehensive list of things Gulp can do. If you’re crazy enough, you can even build a static site generator with Gulp (I’ve done it!). So yes, Gulp is extremely powerful, but you’ll have to learn how to use<\/em> Gulp if you want to create your own customized build processes. <\/p>\n So that’s what this article is for. It helps you get so good with the basics of Gulp that you can begin exploring everything else for yourself. <\/p>\n <\/p>\n Before we dive into working with Gulp, let’s talk about why<\/em> you may want to use Gulp as opposed to other similar tools. <\/p>\n Tools like Gulp are often referred to as “build tools” because they are tools for running the tasks for building a website. The two most popular build tools out there right now are Gulp and Grunt<\/a>. (Chris has a post on getting started with Grunt here<\/a>). But there are others of course. Broccoli<\/a> focuses on asset compilation, one of the most common build tool tasks.<\/p>\n There are already multiple articles covering the difference between Grunt and Gulp and why you might use one over another. You can check out this article<\/a>, this one<\/a>, or this<\/a> if you’re interested in finding out more. Brunch<\/a> is similar in its focus on assets, and it bundles in some of the most common other tasks like a server and file watcher.<\/p>\n The main difference is how you configure a workflow with them. Gulp configurations tend to be much shorter and simpler when compared with Grunt. Gulp also tends to run faster. <\/p>\n Let’s now move on and find out how to setup a workflow with Gulp. <\/p>\n By the end of this article, you’ll have a workflow that does the tasks we outlined at the beginning of this article:<\/p>\n You’ll also learn how to chain together<\/em> different tasks into simple commands that are easy to understand and execute.<\/p>\n Let’s begin by installing Gulp onto your computer.<\/p>\n You need to have Node.js (Node) installed onto your computer before you can install Gulp. <\/p>\n If you do not have Node installed already, you can get it by downloading the package installer from Node’s website<\/a>. <\/p>\n When you’re done with installing Node, you can install Gulp by using the following command in the command line: <\/p>\n\n
Why Gulp?<\/h3>\n
What we’re setting up<\/h3>\n
\n
Installing Gulp<\/h3>\n
$ sudo npm install gulp -g<\/code><\/pre>\n