Johan Bower installed vs npm install vs grunt

This is my first time developing an AngularJS application and using the Yeoman forest tool ( http://yeoman.io/ ). I wanted to use fontawesome for some of my icons ( http://fortawesome.imtqy.com/Font-Awesome/ ), and I know I have to use the command

bower install fontawesome 

However, I also saw this article ( https://www.npmjs.org/package/grunt-font-awesome-vars ) which talks about the npm grunt installation command below

 npm install grunt-font-awesome-vars --save-dev 

What is the difference? I am still a little vague how various tools work and flow together. Can any Yeoman experts give me a low level when I need to use the bower installation, npm install and grunt commands so that I clearly know the differences and understand the flow? Thank you

+6
source share
1 answer

Grunt is a task automation tool that does very little right out of the box. It does most of its work by plugging in grunt modules that perform specific tasks.

grunt-font-awesome-vars is a grunt module (useless without grunts)

bower is a package manager.

npm is a package manager.

(I do not use Yeoman. This is a tool to create your project structure. I do not agree with his opinion on where to go, so I do not deceive him. I configure grunt and bower manually)

Quick and dirty:

install node with npm number. Then from your console (Developer Command Prompt for VS2013, Bash or whatever you use), run the following commands

 npm install grunt --save npm install bower --save npm grunt-font-awesome-vars --save 

Bauer does not need to grunt. grunt is not necessary. grunt doesn't need grunt-font-awesome-vars, but grunt-font-awesome-vars requires a grunt.

Through my work, I use npm to manage the dependencies of packages that I want to automate with grunt. I use conversation to version control my client dependencies.

Additional Information:

There, "Yo, Dawg" describes a conversation that comes to mind when someone asks the difference between him and npm.

"Hey Dugg. We heard that you really like packages, so we installed a package manager inside your package manager."

Basically, the gazebo is another package manager. It installs with npm (which is a separate package manager)

I use npm to manage server tools and dependencies (e.g. grunt, grunt modules, sass, etc.) that I potentially want to automate) and bower for functional client dependencies (e.g. angular, jquery, etc. ... things that I potentially want to keep up to date with the current version)

Installing through bower will use your bower.json. Installation through npm will use your package.json.

 npm install grunt-font-awesome-vars --save-dev 

will install grunt-font-awesome-vars and also update your package.json with devDependency (the -save-dev flag does this) so that it is automatically installed anytime you run

 npm install 

if you change this command to

 npm install grunt-font-awesome-vars -g 

it will install grunt-font-awesome-vars in your node installation location (indicated by your PATH system variable) and will be available to all node instances.

Change the answer to a question from the comments

The answer to the question: also, why do I need the installation command as "grunt-font-awesome-vars -g"

grunt-font-awesome-vars is the name of the module for grunt, which is deployed as a node package. You install grunt modules with the "npm install" command. -g is a flag that instructs npm to install the requested package into global space, making it accessible through your PATH variable. The only things I have installed all over the world right now are the http server, chat and karma. If you do not have packages installed worldwide, you will need to run "npm install" of this package in the current working directory in order to execute the commands of this package. For example, http-server is a node module and executes a command line like any other console application. In this case, the "http-server" command will launch a local HTTP server anywhere you want to serve the site. If I set it to PATH, I can start the http server from anywhere I want without doing anything special. If you do not install it in your PATH, then the http-server executable must be in the directory in which you want to run it. I install it globally, so I no longer need to "npm install". Most of the things you want to pack with your project, and what you can do with the -save flag, and not with -g (or -global ... they do the same).

+14
source

Source: https://habr.com/ru/post/972715/


All Articles