Jacopo Notarstefano
Jacopo Notarstefano

Reputation: 373

What do I do with Bootstrap installed through npm?

Suppose that I ran

$ npm install bootstrap --save

and now I have, inside the node_modules folder, a bootstrap folder containing a Bootstrap distribution. What am I supposed to do with it?

Here's the (simplified) structure of my project, a template for writing blog posts (https://github.com/jacquerie/portfolio-template):

.
├── Gruntfile.js
├── css
│   └── application.css
├── index.html
├── js
│   └── application.js
├── package.json
└── node_modules
    └── bootstrap

I could do something like

$ cp node_modules/bootstrap/dist/css/bootstrap.css css

but that looks rather unelegant and it's a manual step I don't want to remember to do. I could fix the latter creating some task in Gruntfile.js using grunt-contrib-copy to do it for me, but that looks like an hack.

Is there a better way?

Upvotes: 1

Views: 368

Answers (1)

Frederic Le Feurmou
Frederic Le Feurmou

Reputation: 1786

Because of its flat tree dependencies you should use bower instead, npm is meant for server side. Moreover you don't have to change you module of place, directly link your bower_components/bootstrap/dist/css/bootstrap.css to your project.

bower install --save bootstrap

Upvotes: 1

Related Questions