Grunt and Gulp are the popular task runner in Node.js projects. In release
0.1, I have used Grunt in Filer project. And webmaker project uses Gulp indead.
I did some research on their similarities and differences.
Both Grunt and Gulp are to build the process in Node.js base. But they
have different mechanism. Grunt has longer history and Gulp is new.
Plug-ins:
Both Grunt and Gulp relies on the plug-ins to build tasks. They have
large plug-in base. Developers rarely need to developer own building tasks. Grunt
has better community support than Gulp since it has longer history. Grunt
plug-ins often perform multiple tasks; Gulp plug-ins are designed to do one
thing only.
Mechanism in building process:
Grunt needs to generate intermediary files (.tmp/) to disk during the building
process. It uses declarative approach to build tasks. When the build flow is large,
it will be hard to figure out the task execution order. Also, the development
team needs to write the maintenance code.
Gulp is a streaming building system. Streams is the most important
concept of Gulp, which means that you input your files into a pipe from one end
and generate the output file from the other end without any interruptions in
the middle of the process. It makes your task definitions a bit easier to ready.
And it does not have the disk I/O issues since it does not have the
intermediary file written to the disk. However, Gulp requires developers know
Node well to deal with streams, pipes and asynchronous code.
Gruntfile.js vs. Gulpfile.js
Grunt uses JSON-like data configuration files. And Gulp use Javascript
code. There are examples getting from Filer project and Webmaker project.
Gruntfile.js
Both of them have advantages and disadvantages. Developers would consider them to choose the best suitable one. As a beginner in open source community, it is good to learn both of them to help understand the system I am working on.
Source:
No comments:
Post a Comment