Content deleted Content added
Visaldatta (talk | contribs) Content in this edit is translated from the existing German Wikipedia article at de:Gulp.js; see its history for attribution. |
Visaldatta (talk | contribs) Content in this edit is translated from the existing German Wikipedia article at de:Gulp.js; see its history for attribution. |
||
Line 3:
| Manufacturer = Fractal and contributors of the GitHub community
| Current version = <! - Versions please insert intermittently ->
4.0.0 & nbsp; <ref> {{Internet source | url = https:
| Current version release date = <! - Please insert date after the version ->| OS = [[Platform independence | across platforms]]| Language = [[JavaScript]]| Category = [[Toolkit]]
| Royalty = [[MIT license]] <ref> {{Internet source | url = https:
'' 'Gulp.js' '' is a [[process (computer science) | Task]] - Runner, based on [[Node.js]] to several
▲| Royalty = [[MIT license]] <ref> {{Internet source | url = https: //github.com/gulpjs/gulp/blob/master/LICENSE | title = License to github.com | language = en | access = 2016-05-30}} </ ref>
▲'' 'Gulp.js' '' is a [[process (computer science) | Task]] - Runner, based on [[Node.js]] to several [[Workflow | Workflow]] - to automate tasks in Webentwicklungsprozess. <ref> {{cite | author = Joshua Barnett | title = Building a Cross-Platform Mobile game with HTML5 | ed = University of East Anglia | compilation = | band = | number = | edition = | publisher = | ___location = | year = 2014 | pages = | ISBN = | online = http: //www.caffeinatednightmare.com/mindflip/}} </ ref> <ref> {{cite | author = Artemij Fedosejev | title = React.js Essentials | ed = | compilation = | = tape | number = | edition = 1 | publisher = Packt Publishing | place = Birmingham | date = 2015 | chapter = Installing Powerful Tools for Your Project | pages = 12-14 | ISBN = 978-1-78355- 162-0}} </ ref> So can gulp used, for example, to [[hypertext markup Language | HTML]], [[JavaScript]] and [[Cascading style sheets | CSS]] to collapse, [[sass ( stylesheet language) | SCSS]] convert to CSS to optimize images and files in a "dist" - to copy folders. Also can be used gulp this to update the browser automatically or to start the web server automatically <ref> {{cite |. Author = Henri Levälampi | title = Modular Web Development Framework | ed = Helsinki Metropolia University of Applied Sciences | compilation = | band = | number = | edition = | publisher = | ___location = Helsinki | date = 2015-12-04 | pages = | ISBN =}} </ ref>
== Installation ==
Gulp needed [[Node.js]] and installed by the [[Node Package Manager]]. For this purpose, the command <code> {| s | {long npm install --global gulp-cli}} is | run <ref> {{Internet source </
== Operation ==
In order to work with gulp, called gulpfile must be created. In the gulpfile is a [[JavaScript]] - file named "gulpfile.js". In this file called tasks in JavaScript are defined. This gulp tasks are run from the shell. The command <code> {{lang | en | gulp}} </
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. <
// Define Modules
var gulp = require ( 'gulp');
var gutil = require ( 'util-gulp');
</syntaxhighlight>
In the next step, the tasks can then be created. A gulp task is defined by ''
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:
▲In the next step, the 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> <syntax highlight lang = "javascript">
gulp.task ( 'taskName', function () {
});
</syntaxhighlight>
Alternatively, create a task that performs several pre-defined functions. These are passed as the second parameter using an array. <
function fn1 () {
}
function fu2 () {
}
// Task with array of function names
gulp.task ( 'taskName', [ 'fn1', 'fu2']);
</syntaxhighlight>
=== === Default task
The default task is that task that by entering the <code> {{long gulp} | | s} command is executed </
// Gulp default task
gulp.task ( 'default', [ '']);
</syntaxhighlight>
== Example tasks ==
=== === Image Task
For the following example, the '' gulp-imagemin plugin '' <ref>
Subsequently, the module must be at the beginning of '' gulpfile.js 'defined': <
var imagemin = require ( 'gulp-imagemin');
</syntaxhighlight>
The subsequent image Task performs optimizing images. <Code> gulp.src () </
// Images task
gulp.task ( 'images', function () {
});
</syntaxhighlight>
=== === Scripts Task
In the following example, all JavaScript files from the directory '' <nowiki
// Script task
gulp.task ( 'scripts', function () {
});
</syntaxhighlight>
=== === Watch Task
The Watch-task serves to react to changes of files. In the following example, the tasks of the names are '' scripts '' and '' images '' called when it JavaScript files or images should change in the specified directories. <
// Rerun the task When a file changes
gulp.task ( 'watch', function () {
});
</syntaxhighlight>
Furthermore, it is possible to accomplish an update of the browser content using the Watch-tasks <ref> {{Internet source | url = https:
== Literature ==
Line 112 ⟶ 106:
== References ==
<References
{{SORTING: Gulpjs}}
|