问题描述
我应该在 bootstrap.min.css 和 bootstrap.css 之间使用什么?
我对这两个文件感到困惑,因为 bootstrap.css
是可读的,即可以向上滚动 &向下.但是 bootstrap.min.css
很难编辑,因为你只能左右滚动它.
I am confused between the two files because bootstrap.css
is readable i.e. scrollable up & down. But the bootstrap.min.css
is hard to edit since you can only scroll it left and right.
推荐答案
bootstrap.min.css
已缩小.这意味着所有空格和其他额外字符都已被删除.这通常用于生产中,以减少文件的大小.在开发时,使用未压缩版本通常会有所帮助,因为正如您所说,它是可读的.
bootstrap.min.css
has been minified. This means all the whitespace and other extra characters have been removed. This is commonly done for use in production, to reduce the size of the file. When developing, it is usually helpful to use the unminified version, since, as you said, it is readable.
它的工作方式是获取所有变量(例如 number
、tableName
)并将其转换为较短的名称(在本例中,它重命名 number
到 a
,tableName
到 b
),这样文件就会变小一些(从 220 MB 到 219 MB),这基本上就是它正在做的事情,当然它做的更多,但这是您可以掌握它的作用的一部分.
The way it works is that it takes all variables (for example number
, tableName
) and converts it to shorter names (in this example, it renames number
to a
, and tableName
to b
), so that the file becomes a little smaller (from 220 MB to 219 MB), that's essentially what it's doing, of course it does more, but this is one part where you can grasp what it does.
这就是为什么没有空格的原因,因为空格占用 0.1 MB,最好没有它.
That's why there's no white spaces, because a whitespace takes up 0.1 MB and it's best without it.
正如 DrBeza 在评论中提到的,如果您打算修改 bootstrap.css
文件,最好创建一个单独的 .css
文件并添加您自己的 css 规则来覆盖默认值.这样,如果您更新到较新版本的引导程序,您可以简单地换出引导程序文件,而无需编辑新的 bootstrap.css
以将您的修改转移到它.
As mentioned by DrBeza in a comment, if your intention is to modify the bootstrap.css
file, it is much better practice to create a separate .css
file and add your own css rules that override the defaults. This way, if you update to a newer version of bootstrap, you can simply swap out the bootstrap files, instead of needing to edit the new bootstrap.css
to move your modifications over to it.
这篇关于bootstrap.min.css 和 bootstrap.css 有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!