I would like to know what is the use of :
colon when used as follow in a gulp task.
gulp.task('default', ['clean:mobile']);
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.
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.
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...).
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With