Join Ray Villalobos for an in-depth discussion in this video Watching changes to our files, part of Web Project Workflows with Gulp.js, Git, and Browserify.
…Normally when you execute tasks, they do their thing, and then they stop.…Now gulp has a special method called watch, and you…can find out more about watch on the API page.…Scroll down all the way to where it says watch.…Which is right here.…And this method can run continuously in…the background, and monitor changes to files.…When the files change, you can do a couple of things.…Just like with any other task, you can run a callback,…which is one of those functions with no name that we've been using.…
Now the other option is to run a single task, or a series of tasks.…So, what I'm going to do is create a new task…called watch, which will monitor and update things when they change.…We'll start off like any other task, so I'm going to do gulp and then task, and…then in here, we'll call this task watch…because its job is just to watch other things.…So, then in here we'll create a function…literal, which is also known as a callback.…And then what we want to do here, is use…the gulp.watch method to process a series of tasks.…
- Why workflow management?
- Processing tasks with gulp-coffee
- Importing libraries with Browserify
- Processing Sass and Compass
- Issuing tasks in sequence
- Watching changes to files
- Adding static reloads
- Setting up environment variables
- Minifying HTML
- Compressing images
Skill Level Intermediate
Q: When using the exercise files with the "git add" command on a PC, why do I receive warnings saying "LF will be replaced by CRLF"?
A: When running Unix files on a Windows workstation, the text formats are not exactly the same. Line Feeds (LFs) have to be converted to "Carriage Returns + Line Feeds.”