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)

Source maps


Minifying your JavaScript source code into distributable files can be a rough experience when it comes to debugging in the browser. Anytime you hit a snag and check your console for errors, it simply leads to the compiled and unreadable code.

Modern browsers have some features that will make their best attempt to make the compiled code readable; however, all of the variable and function names have likely been renamed to save on file size. This is still too unreadable to be practical and beneficial.

The solution to this is to generate source maps that will allow us to view the unbuilt versions of our code in the browser so that we can properly debug it.

Since we have already established a scripts task, you can simply add an additional plugin called gulp-sourcemaps that you can introduce into our pipechain, which will generate those source maps for us.