I am wondering what's the difference between these 3 ways of including third party code in a project. For example, in bootstrap, I can include the css and javascript with a cdn link, or download the minified versions and include them in the project or install bootstap with a package manager in the directory of my project. I understand that the cdn is not good because maybe there will be a version change and still have the old version's code and it needs internet connection in order to work. But what's the difference between installing bootstrap with a package manager and just download the min versions and include them?
Asked
Active
Viewed 1,571 times
2
-
Possible duplicate of [Purpose of installing bootstrap through npm?](https://stackoverflow.com/questions/26773767/purpose-of-installing-bootstrap-through-npm) – jmargolisvt Oct 04 '17 at 19:53
2 Answers
6
Some quick comparison points:
If you are not connected to the internet, your NPM package will still work. Your CDN link will not.
CDN usually only hosts the most popular stuff. If you want to use a less popular package, you'll want to use NPM.
Updating NPM packages is easier, especially since some forms will look for major/minor updates. You'd have to change your CDN link by hand.

jmargolisvt
- 5,722
- 4
- 29
- 46
1
There is no real difference. What happens with a package manager is that it puts it in a pre-specified directory in your project. That package may include easy ways of including it easier like bundling, but in the end, a package for something like bootstrap just goes and gets the files and puts them in your project. No different than you doing it yourself.

Scott Craig
- 275
- 2
- 10