Gulp.js: Difference between revisions

Content deleted Content added
No edit summary
Stiruma (talk | contribs)
Operation and Installation are modified
Line 24:
Gulp needs [[Node.js]] and can be installed by the [[Node Package Manager]]. To remove a previously installed gulp the command is <code>npm rm --global gulp</code>.
 
Install gulp globally, then initialize the project directory and install in the project locally. While installing the project locally, package.json file must already exist in the selected directory.
'''
$ npm install --global gulp-cli
$ npm init
$ npm install --save-dev gulp'''
This installs gulp locally and is saved at devDependencies in the package.json file.
 
== Operation ==
 
InThis ordergulp totasks workare withrun gulp,from calledthe gulpfileCommand mustLine beInterface created.(CLI) Inshell thelike gulpfileGrunt isand arequire [[JavaScript]] - filepackage.json namedand "gulpfile.js". Inin thisthe fileproject calledroot tasksdirectory. ingulpfile.js JavaScriptis where the plugins are defined.loaded Thisand gulpthe tasks are rundefined.The fromdefault thetask shell.runs The commandby <code> {{lang | en | $gulp}} </code> willand launchdoes the default tasknothing. WithIndividual <code>tasks {{langneed |to enbe |run by <code>gulp <task name>}} <othertask></code>. All the tasknecessary withplugins eachspecified taskNamein runsthe gulpfile are installed into the devDependencies.
 
== Gulpfilegulpfile.js ==
In addition there are a number of [http://gulpjs.com/plugins Plugins] for gulp.
 
== Gulpfile.js ==
In the first step all the modules must be defined in the gulpfile.js. <syntaxhighlight lang="javascript">
//Define Modules
Line 50 ⟶ 49:
</syntaxhighlight>
 
Alternatively, create a task that performs several pre-definedpredefined functions. These are passed as the second parameter using an array. <syntaxhighlight lang="javascript">
function fn1 () {
// do something