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']);
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']);
Share
Improve this question
edited Sep 15, 2017 at 18:50
GibboK
asked Dec 18, 2015 at 10:19
GibboKGibboK
73.9k147 gold badges451 silver badges672 bronze badges
1
-
2
AFAIK it is just a simple way to namespace your tasks in a readable way. In your example the
clean:mobile
task will perform a clean task specifically to themobile
assets I guess. – MarcoL Commented Dec 18, 2015 at 10:51
1 Answer
Reset to default 20Gulp does not give a special meaning to the colon. In projects where it has a special meaning, the meaning es 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.