twitter-bootstrap 如何在 Meteor 中使用引导程序?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/26711577/
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 to use bootstrap in Meteor?
提问by dvplut
I'm trying to use bootstrap in meteor 1.0. I add bootstrap package in meteor with this command: "meteor add bootstrap". But it can't works for me correctly.
我正在尝试在流星 1.0 中使用引导程序。我使用以下命令在meteor 中添加bootstrap 包:“meteor add bootstrap”。但它不能正确地对我来说有效。
I need one row with two columns. This is my html:
我需要一排两列。这是我的 html:
<head>
<meta charset="utf-8">
<title>Аггрегатор новостей</title>
</head>
<body>
<div class="container-fluid">
<div class="row">
<div class="col-md-6">.col-md-6</div>
<div class="col-md-6">.col-md-6</div>
</div>
</div>
</body>
But I see two rows with 100% width. Wherein container or container-fluid works, I see this is one the screen. What is the problem? I need to link bootstrap.css in header? But Meteor do this automatically IMHO.
但我看到两行 100% 宽度。其中 container 或 container-fluid 工作,我看到这是一个屏幕。问题是什么?我需要在标题中链接 bootstrap.css 吗?但是 Meteor 会自动执行此操作恕我直言。
Thank you.
谢谢你。
回答by Stephan
By using meteor add bootstrapyou are actually adding Bootstrap 2.3, which does not know the col-md-xclasses. Either switch to using Bootstrap 3 using meteor add twbs:bootstrapwhich will install the official Bootstrap framework (v3) or adjust your code to
通过使用,meteor add bootstrap您实际上是在添加 Bootstrap 2.3,它不知道这些col-md-x类。要么切换到使用 Bootstrap 3 使用meteor add twbs:bootstrap它将安装官方 Bootstrap 框架 (v3) 或调整您的代码
<div class="span6">span4</div>
Personally, I prefer using Bootstrap 3 instead of the core bootstrap package coming with Meteor core. Also, the boostrap package provided by MDG is marked as deprecated.
就个人而言,我更喜欢使用 Bootstrap 3 而不是 Meteor 核心附带的核心引导程序包。此外,MDG 提供的 boostrap 包被标记为 deprecated。
回答by FullStack
回答by Andrew Mao
Starting from Meteor 1.3 which offers first-class npmsupport, the recommended approach is to install Bootstrap directly from npm.
从提供一流npm支持的Meteor 1.3 开始,推荐的方法是直接从 npm 安装 Bootstrap。
$ meteor npm install --save bootstrap
(This also saves bootstrapin your package.jsonfile so someone else who checks out your app can install it with meteor npm install.)
(这也会保存bootstrap在您的package.json文件中,以便检查您的应用程序的其他人可以安装它meteor npm install。)
Then, in any client-side JS file (e.g. /client/main.js):
然后,在任何客户端 JS 文件(例如/client/main.js)中:
import 'bootstrap';
import 'bootstrap/dist/css/bootstrap.css';
import 'bootstrap/dist/css/bootstrap-theme.css';
If you're interested in more customized Bootstrap installs using SASS/SCSS, etc. check out this post.
如果您对使用 SASS/SCSS 等进行更多自定义 Bootstrap 安装感兴趣,请查看这篇文章。
回答by juliancwirko
Have you tried with other package? For example with : https://atmospherejs.com/mizzao/bootstrap-3
您是否尝试过其他软件包?例如:https: //atmospherejs.com/mizzao/bootstrap-3
I think that Meteor has dropped core Bootstrap package.
我认为 Meteor 已经放弃了核心 Bootstrap 包。

