通过npm安装bootstrap的目的? [英] Purpose of installing bootstrap through npm?
问题描述
问题1:
通过npm安装bootstrap的目的是什么?我以为npm是服务器端的模块。自动服务自举文件比使用CDN更快?
What exactly is the purpose of installing bootstrap through npm? I thought npm was meant for server side modules. Is it faster to serve the bootstrap files yourself than using a CDN?
问题2:
如果我要npm安装引导程序,我该如何指向bootstrap.js和bootstrap.css文件?
If I were to npm install bootstrap, how would I point to the bootstrap.js and bootstrap.css files?
推荐答案
答案1:
-
通过npm(或bower)下载引导允许您获得一些延迟时间。而不是得到一个远程资源,你可以得到一个本地的资源,这是更快的,除非你使用cdn(检查下面的答案)
Downloading bootstrap through npm (or bower) permits you to gain some latency time. Instead of getting a remote resource, you get a local one, it's quicker, except if you use a cdn (check below answer)
npm原来是得到节点模块,但是随着Javascript语言的出现(以及browserify的出现),它已经有一点长大了。其实你甚至可以在npm下载AngularJS,这不是一个服务器端框架。 Browserify允许您在客户端使用AMD / RequireJS / CommonJS,因此可以在客户端使用节点模块。
"npm" was originally to get Node Module, but with the essort of the Javascript language (and the advent of browserify), it has a bit grown up. In fact, you can even download AngularJS on npm, that is not a server side framework. Browserify permits you to use AMD/RequireJS/CommonJS on client side so node modules can be used on client side.
答案2:
如果您的npm安装引导程序(如果您不使用特定的grunt或gulp文件移动到dist文件夹),您的如果我没有错,引导将位于./node_modules/bootstrap/bootstrap.min.css中。
If you npm install bootstrap (if you dont use a particular grunt or gulp file to move to a dist folder), your bootstrap will be located in "./node_modules/bootstrap/bootstrap.min.css" if I m not wrong.
这篇关于通过npm安装bootstrap的目的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!