Gulp.js: Difference between revisions

Content deleted Content added
Stiruma (talk | contribs)
Operation and Installation are modified
Stiruma (talk | contribs)
m Grammatical mistakes
Line 33:
== Operation ==
 
This gulp tasks are run from the Command Line Interface (CLI) shell like Grunt and require package.json and gulpfile.js in the project root directory. gulpfile.js is where the plugins are loaded and the tasks are defined. First, all the necessary modules are loaded and then tasks are defined in the gulpfile. All the necessary plugins specified in the gulpfile are installed into the devDependencies. The default task runs by <code>$gulp</code> and does nothing. Individual tasks can be defined by gulp.task and need to be run by <code>gulp <task> <othertask></code>. AllComplex thetasks necessaryare pluginsdefined specifiedby inchaining the gulpfileplugins arewith installedthe intohelp theof devDependencies<code>.pipe()</code> operator.
 
== gulpfile.js ==
Line 41:
var gutil = require ( 'util-gulp');
</syntaxhighlight>
In the next step, theThe tasks can then be created. A gulp task is defined by ''gulp.task'' and gets a name for the task as the first parameter and the second parameter is a function.
 
The following example shows the creation of a gulp tasks. The first parameter '' taskName '' is mandatory and specifies the name by which the task in the shell can be executed <ref> {{Internet source | url = https://github.com/gulpjs/gulp/blob/4.0/docs/API.md | title = gulp API docs | author = | ed = | = factory gulp.js | date = | language = en | access = 2016-05-28}} </ref> <syntaxhighlight lang = "javascript">
Line 49:
</syntaxhighlight>
 
Alternatively, create a task that performs several predefined functions can be created. TheseThose functions are passed as the second parameter using an array. <syntaxhighlight lang="javascript">
function fn1 () {
// do something