目录结构

Bootstrap每次都会以预编译版、源代码两种形式发布。下面我们介绍两种形式的内容和结构。注意无论使用哪种形式,Bootstrap的JavaScript插件都需要jQuery。

Bootstrap 编译引导

下载解压文件BootStrap文件包后,你会看到以下目标结构和文件列表::

bootstrap/
├── css/
│   ├── bootstrap-grid.css
│   ├── bootstrap-grid.css.map
│   ├── bootstrap-grid.min.css
│   ├── bootstrap-grid.min.css.map
│   ├── bootstrap-reboot.css
│   ├── bootstrap-reboot.css.map
│   ├── bootstrap-reboot.min.css
│   ├── bootstrap-reboot.min.css.map
│   ├── bootstrap.css
│   ├── bootstrap.css.map
│   ├── bootstrap.min.css
│   └── bootstrap.min.css.map
└── js/
    ├── bootstrap.bundle.js
    ├── bootstrap.bundle.js.map
    ├── bootstrap.bundle.min.js
    ├── bootstrap.bundle.min.js.map
    ├── bootstrap.js
    ├── bootstrap.js.map
    ├── bootstrap.min.js
    └── bootstrap.min.js.map

这是 Bootstrap 最基础的形式:直接拖入即用的编译文件,几乎能在所有Web项目中使用。
其中bootstrap.*是预编译的文件。
bootstrap.min.*是编译过且压缩后的文件,用户可以根据自己需要引用。
程序目录中,还有bootstrap.*.map格式的文件,这是Source map文件,需要在特定的浏览器开发者工具下才可用式。

CSS 文件功能对比与清单

文件 布局 内容 组件 公共样式
bootstrap.css
bootstrap.min.css
Included Included Included Included
bootstrap-grid.css
bootstrap-grid.min.css
只作用 grid 类 不包含 不包含 只作用 flex 类
bootstrap-reboot.css
bootstrap-reboot.min.css
不包含 Only Reboot 不包含 不包含

JS 文件功能对比与清单

同样,我们有选择包括一些或所有我们编译的JavaScript。

JS files Popper jQuery
bootstrap.bundle.js
bootstrap.bundle.min.js
包含 不包含
bootstrap.js
bootstrap.min.js
不包含 不包含

资源清单

Bootstrap 源代码包中包含了预编译的CSS和JavaScript资源,以及源Sass、JavaScript、例子和文档,核心结构如下:

bootstrap/
├── dist/
│   ├── css/
│   └── js/
├── site/
│   └──docs/
│      └── 4.3/
│          └── examples/
├── js/
└── scss/

scss/js/是CSS和JavaScript的源码。
dist/文件夹包括上述列举的所有预编译的下载文件,一般网页都是读取dist目录下的文件。
docs/文件夹是开发者文件夹。
examples/是例子。
其它文件则是对整个BootStrap开发、编译提供支持的文件以及授权信息、支持文档。