Bootstrap and jQuery using node js

I would like to know when I run these 2 commands:

npm install jquery
npm install boostrap

Than I add two dependencies in the package.json file. Than in my app.js file i am code

var $ = require('jquery'); var bootstrap = require('bootstrap');

In my index.ejs file, do I need to put a link to a jquery or css file, or can I use these libraries directly?

If not, can someone please indicate the configuration that I need to use bootstrap with npm.

+4
source share
3 answers

Bower , . Bower , (.. jquery).

:

npm install -g bower

:

bower install bootstrap --save

Bootstrap jquery , , .

:

bower list --path

index.ejs. bootstrap.less. bootstrap.css, . :

bower_components/bootstrap/dist/css/bootstrap.css

, .

, . !!

+9

, bootstrap-css. , , .less.

bower install bootstrap-css

....

+3

For jQuery, yes, you can see the Node part here, you will find instructions: https://www.npmjs.com/package/jquery

Or you can simply declare a script file.

But for bootstrap, I believe that you should include css and js files downloaded from npm (you will find them in the node_modules directory) directly to the web page, because bootstrap is not really a package, it is a css framework.

0
source

All Articles