Book Image

Getting Started with Gulp

By : Travis Maynard
Book Image

Getting Started with Gulp

By: Travis Maynard

Overview of this book

<p>Gulp is a fast and powerful JavaScript task runner that is built upon the node.js platform. It allows you to create tasks that can automate common workflow processes. Gulp.js is comparatively new and has been developed keeping in mind the issues that developers have encountered with Grunt.</p> <p>Getting Started with Gulp introduces you to the world of building and testing JavaScript applications using gulp. This book is a hands-on guide to get you up to speed with gulp. It will instill you with the ability to automate several common development tasks to vastly improve your development workflow. It will get you started with gulp quickly and efficiently, providing you with core concepts of gulp, node.js, and npm.</p> <p>By the end of this book, you will be able to create your very own gulp environments from scratch, create and maintain tasks and project builds, and automate your workflow with plugins and custom tasks.</p>
Table of Contents (14 chapters)

Static server


For quick and easy distribution, having the ability to spin up a small file server can be a great time saver and will prevent the need to run larger server software such as Apache or Nginx.

For this task, instead of using a gulp plugin we are going to use the Connect middleware framework module. Middleware is a small layer that allows us to build additional functionality into our applications, or in this case our gulp tasks.

Connect itself only acts as the framework to pull in additional functionality, so in addition to Connect we will need to install the plugin that we wish to use. To spin up a static server, we will be using the serve-static node.js module.

Installing modules

Installing plain node.js modules is exactly the same process as installing gulp plugins because, despite the gulp focus, gulp plugins are still node.js modules at heart. The modules we will be using for this specific task are connect and serve-static.

To install connect and serve-static, we will run the following...