最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

javascript - Confused about Node, NPM, Bower, and using it for Bootstrap - Stack Overflow

matteradmin12PV0评论

I'm trying to learn the latest technologies for web development. I already know HTML, JS, CSS, and server side programming. But I don't understand where Nodejs, npm, and Bower e in.

I want to create a new project. So I created a folder for it. Then I wanted to use bootstrap. So I ran bower install bootstrap. Now I have bootstrap installed in a folder called bower_ponents. Does this mean, if I want to import Bootstrap, I have to add it like this?:

<link href="bower_ponents/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">

Or am I missing something. I honestly don't know where to start with these package managers.

I'm trying to learn the latest technologies for web development. I already know HTML, JS, CSS, and server side programming. But I don't understand where Nodejs, npm, and Bower e in.

I want to create a new project. So I created a folder for it. Then I wanted to use bootstrap. So I ran bower install bootstrap. Now I have bootstrap installed in a folder called bower_ponents. Does this mean, if I want to import Bootstrap, I have to add it like this?:

<link href="bower_ponents/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">

Or am I missing something. I honestly don't know where to start with these package managers.

Share Improve this question edited Jun 29, 2015 at 16:07 Siguza 23.9k6 gold badges55 silver badges98 bronze badges asked Mar 14, 2015 at 5:16 AskYousAskYous 4,7409 gold badges53 silver badges91 bronze badges 2
  • Now your next step is to learn to use gulp.js and to make gulp do all your build steps. That would include copying over bootstrap/dist/css/bootstrap.min.css and all the other css into, say, public/css, and do all the JS and CSS minification and concatenation and make your public/ folder contain something like 6 files (out of 150 that you work with in the project) which you would use for production deployment :) – Zlatko Commented Mar 15, 2015 at 8:56
  • @Zlatko Interesting... Thanks! – AskYous Commented Mar 15, 2015 at 8:57
Add a ment  | 

1 Answer 1

Reset to default 19

bower - for installing client-side libraries/ modules( e.g: jquery, bootstrap, angular etc.), module details generally put in bower.json of project root folder

npm - for installing server-side modules (express, crypto, socket.io, etc.), module details generally put in package.json of project root folder.

In general, the things you install using npm get stored in the folder node_modules and bower puts it in bower_ponents,

I am assuming you are using express module on node.js server. When you add a line like:

app.use(express.static(__dirname+ '/bower_ponents'));

Now your HTML files, can use the bower ponents as

<link href="bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">

Another option is to edit .bowerrc and specify where the downloaded bower modules must be put...

Post a comment

comment list (0)

  1. No comments so far