

Here’s a brief overview of the steps to get you started: Set up Continuous Integration (CI) for your JavaScript project.īy the end of the tutorial, you will be able to apply Gulp to your own project, customize it and be more efficient.Automatically reload the page in the browser after changes.Watch for changes in your files and act on it.
Gulp watch new files how to#
We will make a quick project to demonstrate how tasks work, and how to create an integrated workflow. The goal of this tutorial is to introduce Gulp and see it in action.

This results in faster builds because there is no need to create and read intermediary files on the hard drive. It only needs to read a file once, then process it through multiple tasks, and finally write the output file. What makes Gulp different from other task runners is that it uses Node streams piping output from one task as an input to the next. Gulp let us automate processes and run repetitive tasks with ease. We have added: gulp.Gulp is a command-line task runner for Node.js. The two var definitions are the same as last time, as is the minify-css task. Ok, nothing super crazy going on here, but let's step through it anyway. Var minif圜ss = require('gulp-minify-css') Let's build on the example from the previous video by adding a watch tasks: // project_root/gulpfile.js

Lies aside, gulp.watch is incredibly powerful and useful. Gulp Watch Exampleĭid you know, Apple got their idea for the Watch from Gulp. After that, it does its thing with no further attention needed. I say 99% / almost, and that's because we must start Gulp initially. We have all these cool time saving tasks happening for us with almost no effort. This is where Gulp starts to get really powerful. When Gulp spots a change it will re-run the tasks we tell it to run. css files for example - or entire directories, or any combination you can think of. We can tell Gulp to watch for changes to specific files, or every file with a specific extension - all.

Instead we want Gulp to do 99% of the work for us. We don't want to have to be swapping back and forth between our console and our IDE, jabbing at the up arrow then stabbing return each and every time we make a change. Now let's make our lives even easier with this Gulp Watch example. In the first video we saw how easy it is to get started using Gulp.
