5. More
technically..
❶ from command line…
$ npm install -g gulp
(install Gulp globally)
❷ create
gulpfile.js & package.json
(on your project folder.
See at slide 13-15 for
more details)
❸ from command line..
$ npm install [plugin_name]
--save (project folder)
9. API
src
Takes a glob & represents a file
structure
gulp.src(globs)
globs → file path
10. API
pipe
for data streaming
(output from prev. process become
input for the next process)
Makes Gulp different compared to
Grunt
.pipe([data_stream])
data_stream → task or file
destination
12. API
watch
Watch files and do something
when a file changes
• gulp.watch(glob, fn)
glob → file(s) to watch for changes.
fn → defined function
(added with gulp.task())
13. gulpfile.js
var [variable_name] = require(‘[plugin_name]');
⋮
gulp.task(‘[task_name]’, function () {
return gulp
.src(‘[file_name]’)
.pipe( [variable_name]() ) ;
⋮
});