admin管理员组文章数量:1293367
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
1 Answer
Reset to default 19bower
- 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...
本文标签:
版权声明:本文标题:javascript - Confused about Node, NPM, Bower, and using it for Bootstrap - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1740085087a2223687.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论