compiling ES6 JavaScript code to ES5 (using Babel, Traceur, or TypeScript).validating/linting HTML, CSS, JavaScript, and JSON files.To get an updated count in a *nix environment, runĬommon tasks that may be run using gulp include: A large number of plugins are available: 1,711 as of 5/25/15. Typically, plugins are used in the implemention of gulp tasks. For a thorough discussion of ES6 features, please visit these slides. For purposes of this article, all you need to know is that function () in ES5 is roughly equivalent to () => expression in ES6. This feature provides a more concise way to write anonymous functions, and it has other benefits ("lexical this"). One ES6 feature, used in some examples in this article, is the arrow function expression. In a Windows environment, consider using the doskey command to define something similar to a *nix alias. After this, run gulp commands with gulp6 instead of gulp. To get gulp to use this in a *nix environment, create an alias like the following: alias gulp6='node -harmony $(which gulp)'. With both Node.js and io.js, some ES6 (a.k.a ES 2015) features may be used if the -harmony flag is set.
Like Node.js itself, gulp may be used in Windows, Mac OS X, and *nix operating systems. It can also run on io.js, which is a fork of Node.js that uses a newer version of the Chrome V8 JavaScript engine and releases new versions more frequently. Using streams allows subsequent steps to begin earlier, as soon as data is available in a stream, instead of waiting for a file to be completely written. The alternative, used by Grunt, is creating many temporary files that are used to make data available to subsequent steps. Grunt configuration is primarily done by passing a rather large object literal to one function.Īs a rule, gulp runs faster than Grunt due to its use of streams. Configuration for gulp is accomplished with calls to various functions. Both use a JavaScript source file: one named gulpfile.js and the other Gruntfile.js. One major difference between gulp and Grunt is the way each is configured.
Other contenders (far less popular) include: Broccoli, Brunch, Cake, and Jake. Gulp competes with tools like Grunt, which (like gulp) is also free and open source.
However, in practice, gulp is primarily used for tasks associated with web development. Gulp is a JavaScript-based build tool for automating the execution of web development tasks.Īctually, gulp can automate anything that may be done from Node.js, and since Node.js can run shell commands, gulp may actually be used to automate any task.