简体   繁体   English

将Bootstrap与Node.js结合使用

[英]Using Bootstrap with Node.js

I have finished a small web app wiht Node.js. 我已经完成了一个带有Node.js的小型Web应用程序。 But i can't upload this thing yet because it looks so ugly! 但是我还不能上传这个东西,因为它看起来太丑了! I am trying to prettify it with Bootstrap. 我试图用Bootstrap来美化它。

Having never worked with it before, i have some trouble getting it started. 以前从未使用过它,因此在启动它时遇到了一些麻烦。 I downloaded the Bootstrap and unzip it into my public folder. 我下载了Bootstrap并将其解压缩到我的公用文件夹中。 So it now contains the folders [images, css, js]. 因此,它现在包含文件夹[images,css,js]。 Is this how it is supposed to be? 这是应该的样子吗?

Then one of my ejs files contained this line: 然后我的一个ejs文件包含以下行:

<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.2/css/bootstrap.min.css">

Because i had initially based this from an online template. 因为我最初是基于在线模板创建的。 So now i guess this line has to change to point to my locally installed bootstrap files? 所以现在我猜想这行必须更改为指向本地安装的引导程序文件?

If you downloaded bootstrap, then there's no need to use CDN. 如果您下载了引导程序,则无需使用CDN。 Just upload all the bootstrap with your website and include them in your html file with relative paths, read more here https://www.w3schools.com/html/html_filepaths.asp 只需将所有引导程序上传到您的网站,并将它们包含在带有相对路径的html文件中,即可在此处阅读更多内容https://www.w3schools.com/html/html_filepaths.asp

Not necessarily, you could still point to the CDN. 不一定,您仍然可以指向CDN。

Anyway, if you want to install it you can do it through npm or any other package manager: 无论如何,如果要安装它,则可以通过npm或任何其他软件包管理器进行安装:

npm install bootstrap

Read about the differences in this question . 阅读有关此问题的区别。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM