Recently embarked on the development of a new project, intends to work from an engineering perspective of a set of its own front-end development, release system.
Grunt these tools, before others use I also use, and did not seriously think about their past life, just take advantage of this opportunity, I have to reason for the current industry is more popular these tools of use and mutual relationship.
First, the noun explanation
nodejs--environment where JS code can be executed locally (Java-like JDK)
Npm--nodejs Management and distribution tools for packages
grunt--run on Nodejs, task-based, project building tools (Maven in Npm+grunt≈java)
My understanding is to build a web front-end project as an example:
1. In order to conveniently compress the JS file, I wrote a nodejs program A;
2. Later the project also appeared merged JS, compression CSS and other requirements, so I continued to write the Nodejs program BCD;
3. With the increase in ABCD, and ABCD to meet the flexible configuration requirements of my different projects, it is urgent to need a tool to manage the introduction and configuration of many Nodejs programs, So--grunt appeared;
4. Grunt fire up, I also want to use, that before the JS compression program A because it is not compatible with grunt, so I made a slight change, made a for grunt;
5. Slowly many developers on the Nodejs developed a lot of XX for Grunt and played a popular name, called Grunt plug-ins, can be managed through NPM;
The above set of systems, and then take Java to do the following analogy:
Jetty is a javaweb server, I can directly install the boot, can also use MAVEN this tool to install "Jetty for maven" This plugin and launch it;
Uglify is a nodejs program, I can directly introduce the run, can also use grunt this tool to download the introduction of "grunt-contrib-uglify" this plugin and run it.
Nodejs, NPM, grunt--noun explanation