在我的项目中使用Bootstrap 4 Source的正确安装过程是什么

时间:2016-05-25 20:45:31

标签: twitter-bootstrap-4 bootstrap-4

好的,所以我已经阅读过这方面的文档,甚至没有尝试过,因为它只是在我脑海中。

我有一个项目文件夹:

example.com

我想通过自定义变量以及在特定项目上编译哪些文件来习惯使用bootstrap的全部功能。

我的机器上安装了node.js,因此我可以访问npm,grunt等。

我已经从here下载了源文件,但如果这是一个更好的选择,我并不反对使用npm进行安装。 注意我需要知道如何从node_modules编译到我可以链接到.html文件的文件中。

我的主要问题是,如果我从站点下载源文件以在我的项目中使用,那么在文件结构中,源文件与项目的其余部分以及我自己的SCSS和JS相关。 / p>

希望你能帮忙! 克雷格

1 个答案:

答案 0 :(得分:0)

如果您的项目的文件夹结构是;

project
|-- node_modules
|-- public
|   |-- css
|   |-- img
|   |-- js
|   |-- index.html
|-- package.json

然后,

$ npm install bootstrap

会将引导程序安装到./node_modules/bootstrap/bootstrap.min.css

或者,您可以在您的网页中使用bootstrap CDN ;

<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">

<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" integrity="sha384-fLW2N01lMqjakBkx3l/M9EahuwpSfeNvV63J5ezn3uZzapT0u7EYsXMjQV+0En5r" crossorigin="anonymous">

<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>

更多信息在Bootstrap的官方installation guide