Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does it means call a task with a colon in gulp?

I would like to know what is the use of : colon when used as follow in a gulp task.

  • Does it pass a parameters?

gulp.task('default', ['clean:mobile']);
like image 295
GibboK Avatar asked Dec 18 '15 10:12

GibboK


People also ask

How do you call a gulp task?

task('b', () => {}); gulp. task('c', ['a', 'c'], () => {}); Tasks 'a' and 'b' will be run every time after task 'c' is called and before task 'c' is executed.

What does gulp command do?

Gulp purely uses the JavaScript code and helps to run front-end tasks and large-scale web applications. It builds system automated tasks like CSS and HTML minification, concatenating library files, and compiling the SASS files.

What is grunt and gulp?

gulp and Grunt are task runners. They are different approaches to same problem. Grunt uses configuration based approach, while gulp uses streams from node to achieve result. You use them to define how and which tasks to execute (copying files, adding banners, replacing text, style checking, etc...).


1 Answers

Gulp does not give a special meaning to the colon. In projects where it has a special meaning, the meaning comes from somewhere else than Gulp: project culture or history, other tools, etc.

Some people use it as a way to organize their task names. All tasks that have to do with cleanup could start with clean:. So you'd have clean:dist, clean:build, etc. (If you wonder why the multiple targets for cleaning, some people like to have multiple degrees of cleaning. clean:build would remove transpiled files but would leave some local configuration files alone. clean:dist would remove all files that are not part of the source distribution (i.e. remove more).)

Some people will use hyphens for the same goal, or some other character. Gulp-tools like this one may interpret the colon as an organization device. Note that this tool also interprets the underscore (_) and the hyphen (-) in the same as it interprets the colon.

The colon is meaningful in Grunt. People who convert a build system from Grunt to Gulp may keep the colons because their original tasks in Grunt had colons in them. If you have a team used to the task names originally created in Grunt, or interface with other tools that call these tasks, it may be advantageous to just keep the colons instead of having to ask people to adapt or have to update code that calls build tasks.

like image 180
Louis Avatar answered Oct 11 '22 19:10

Louis