twitter-bootstrap 如何识别 Bootstrap 版本?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15335537/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do I identify the Bootstrap version?
提问by Nikita
I want to update Bootstrap on a site, but I don't know the installed version.
我想在网站上更新 Bootstrap,但我不知道安装的版本。
How can I identify the bootstrap version, with only bootstrap.css and bootstrap.min.js files?
如何识别引导程序版本,只有 bootstrap.css 和 bootstrap.min.js 文件?
There is no version in the CSS file and the min.js file contains the following comment.
CSS 文件中没有版本,min.js 文件包含以下注释。
/*!
* Bootstrap.js by @fat & @mdo
* Copyright 2012 Twitter, Inc.
* http://www.apache.org/licenses/LICENSE-2.0.txt
*/
回答by Tanner
In the top of the bootstrap.cssyou should have comments like the below:
在顶部,bootstrap.css您应该有如下评论:
/*!
* Bootstrap v2.3.1
*
* Copyright 2012 Twitter, Inc
* Licensed under the Apache License v2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Designed and built with all the love in the world @twitter by @mdo and @fat.
*/
If they are not there, then they have probably been deleted.
如果它们不存在,那么它们可能已被删除。
VERSIONS:
版本:
You can review version history here. Backward compatibility shouldn't be broken if the source is v2.0.0 (Jan 2012) and above. If it is prior to v2.0.0 there are details on upgrading here.
您可以在此处查看版本历史记录。如果源是 v2.0.0(2012 年 1 月)及更高版本,则不应破坏向后兼容性。如果是之前V2.0.0上有升级的细节在这里。
回答by WasiF
METHOD 1
方法一
In Package.json
在 Package.json
"dependencies": {
// ...
"bootstrap": "4.1.3"
// ...
}
METHOD 2
方法二
- Open
node_modulesfolder and under that - Search and open
bootstrapfolder - Now you'll be able to see version number in the following files
package.jsonscss/bootstrap.scssorcss/bootstrap.cssREADME.md- and there are other files too
- 打开
node_modules文件夹并在其下 - 搜索并打开
bootstrap文件夹 - 现在您将能够在以下文件中看到版本号
package.jsonscss/bootstrap.scss或者css/bootstrap.cssREADME.md- 还有其他文件
回答by Nuclearman
You can also check the bootstrap version via the javascript console in the browser:
您还可以通过浏览器中的 javascript 控制台检查引导程序版本:
$.fn.tooltip.Constructor.VERSION // => "3.3.7"
Credit: https://stackoverflow.com/a/43233731/1608226
信用:https: //stackoverflow.com/a/43233731/1608226
Posting this here because I always come across this question when I forget to include JavaScript in the search and wind up on this question instead of the one above. If this helps you, be sure to upvote that answer as well.
在这里发布这个是因为当我忘记在搜索中包含 JavaScript 并最终解决这个问题而不是上面的问题时,我总是会遇到这个问题。如果这对您有帮助,请务必也为该答案点赞。
回答by Billy Moat
The Bootstrap version will be stated at the top of the CSS file. Simply open it and look at the top of the file.
Bootstrap 版本将在 CSS 文件的顶部说明。只需打开它并查看文件的顶部。
e.g.
例如
/*!
* Bootstrap v2.3.0
*
* Copyright 2012 Twitter, Inc
* Licensed under the Apache License v2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Designed and built with all the love in the world @twitter by @mdo and @fat.
*/
回答by wizoriousPRIME
Shoud be stated on the top of the page.
应该在页面顶部说明。
Something like.
就像是。
/* =========================================================
* bootstrap-modal.js v1.4.0
* http://twitter.github.com/bootstrap/javascript.html#modal
* =========================================================
* Copyright 2011 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ========================================================= */
回答by Akash Yellappa
The easiest would be to locate the bootstrap file (bootstrap.css OR bootstrap.min.css) and read through the docblock, you'll see something like this
最简单的方法是找到引导程序文件(bootstrap.css 或 bootstrap.min.css)并通读 docblock,你会看到类似这样的内容
Bootstrap v3.3.6 (http://getbootstrap.com)
Bootstrap v3.3.6 (http://getbootstrap.com)
回答by Vrian7
An easy way to do this, without searching files or folders would be:
一种无需搜索文件或文件夹的简单方法是:
- Open your web page on browser
- press ctrl+U
- search boostrap.min.js or boostrap.min.css, then click it (it would open source file)
- at first line(commented) you should see boostrap version
- 在浏览器上打开您的网页
- 按 ctrl+U
- 搜索 boostrap.min.js 或 boostrap.min.css,然后点击它(它会打开源文件)
- 在第一行(评论)你应该看到 boostrap 版本
回答by Akash Yellappa
Open package.json and look under dependencies. You should see:
打开 package.json 并查看依赖项。你应该看到:
"dependencies": {
...
"bootstrap-less": "^3.8.8"
...
}
for angular 5 and over
角 5 及以上
回答by Tab
That comment looks like it is a custom version of Bootstrap v2.3.3, here is the default header in the .css, notice the last comment line:
该注释看起来像是 Bootstrap v2.3.3 的自定义版本,这里是 .css 中的默认标题,注意最后的注释行:
/*!
* Bootstrap v2.3.2
*
* Copyright 2013 Twitter, Inc
* Licensed under the Apache License v2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Designed and built with all the love in the world by @mdo and @fat.
*/
What are you trying to accomplish? If it's customization then you have a set of files to work with though that seems like a bad idea. Otherwise, I would suggest going with the full build of v4.1.x since that is the current release.
你想达到什么目的?如果它是定制的,那么您有一组文件可以使用,尽管这似乎是一个坏主意。否则,我建议使用 v4.1.x 的完整版本,因为这是当前版本。
回答by Susie
To check what version you currently have, you can use -v for the command line/console terminal.
要检查您当前拥有的版本,您可以将 -v 用于命令行/控制台终端。
bootstrap -v
引导程序 -v

