为什么Bootstrap包括一个引导主题文件? [英] Why does Bootstrap include a bootstrap-theme file?

查看:104
本文介绍了为什么Bootstrap包括一个引导主题文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题类似于:如何使用bootstrap-theme.css与引导3?,但不是重复。我正在以无级的方式与Bootstrap进行交互,并在每次进行更改时重新编译。

The question is similar to this one: How to use bootstrap-theme.css with bootstrap 3? but not a duplicate. I'm interacting with Bootstrap at .less level and recompiling it every time I make a change.

正如我所说,我正在开发一个Bootstrap主题 less 。我在这里编辑位,在那里改变变量。切割未使用的组件。把我的新CSS的大部分到 /less/theme.less 。在它的末尾,我有两个css文件: /dist/css/bootstrap.css / dist / css / bootstrap-主题(哦,好吧,是的...和他们的 .min.css 对手,你教你知道)

As I say, I'm developing a Bootstrap theme with less. I'm editing bits here, changing variables there. Cutting out unused components. Putting most of my new CSS into /less/theme.less. At the end of it, I'm left with two css files: /dist/css/bootstrap.css and /dist/css/bootstrap-theme (Oh okay, yes... and their .min.css counterparts, you pedantic knowitall)

将这个输出分成两个独立的文件是什么?他们都偏离了stock设置(只是改变了 less / variables。少会这样做)所以这不是重复的努力吗?这是不是这是额外的请求,我们(开发人员认为他们知道最好)不断告诉大三的应该避免任何代价?

What is the point of splitting this output into two separate files? They've both deviated from the "stock" settings (just altering less/variables.less will do that) so isn't this a duplication of effort? Isn't this the extra request that we (developers who think they know best) are constantly telling juniors should be avoided at any cost?

当开发自定义Bootstrap主题,这些是我的选项:

When developing custom Bootstrap themes, these are my options:


  1. 将所包含的 theme.less 主要Bootstrap版本

  2. 在核心引导程序版本中不更改,并覆盖我的 theme.less

  3. 继续我在做什么,改变两者并使用两个CSS文件。

  1. Ditch the included theme.less and include my alterations in the main Bootstrap build,
  2. Alter nothing in the core bootstrap build and override things in my theme.less,
  3. Continue what I'm doing, altering both and using two CSS files.

在相关的注意事项上,如果您单击下载Bootstrap,我是否应该从您获得的文件构建Bootstrap?事后看来,这些似乎是建立在Bootstrap文档(有一吨Jekyll废话在那里,我只是沟)。有没有一个干净的Bootstrap版本,是谁想要自定义Bootstrap没有文档?

On a related note, should I not be building Bootstrap from the files that you get if you click Download Bootstrap? In hindsight these seem to be geared toward building out the Bootstrap documentation (there's a ton of Jekyll nonsense in there that I just ditch). Is there a "clean" version of Bootstrap that is for people wanting to customise Bootstrap without the documentation?

推荐答案

并获得此响应


我们不会将文档分离到另一个仓库,因为它让更多的痛苦/难以保持他们最新的代码更改。

We're not separating the docs into another repo because it makes it much more painful/difficult to keep them up-to-date with changes to the code.

很可爱的IMO,但它不是我的项目管理。经过一个小时的问,我结合前两个选项。我在 bootstrap.less 的最后一行添加了以下内容:

Pretty pathetic IMO but it's not my project to manage. After an hour of asking I went with combining the first two options. I added the following to the very last line of bootstrap.less:

@import "theme.less";

要使这项工作在现实中,需要进行一些更改:

To make that work in reality, there are a couple of alterations required:


  • 清除Gruntfile以停止构建单独的主题

  • 从theme.less文件顶部删除Bootstrap导入如果没有这样做会导致循环)

但输出是所需的。一个胖 bootstrap.css 文件和稍微更小的 bootstrap.min.css 文件。

But the output is as desired. One fat bootstrap.css file and a slightly slimmer bootstrap.min.css file.

我仍然不觉得黑客的整个构建过程是一个非常可持续的方法使用Bootstrap作为一个入门主题。非常愿意接受更好的解决方案。

I still don't feel like hacking the whole build process is a very sustainable method of using Bootstrap as a starter theme. Very open to better solutions.

在另一个项目中,我转储了最终的导入,在 bootstrap.less 中。当然,在顶部有50行,是一个负载的样板进口,但它意味着我不是在文件之间跳跃几乎一样多。我知道正在包括什么。

In another project I have dumped the final import and I'm just doing all my work in bootstrap.less. Sure, there are 50 lines at the top that are a load of boilerplate imports but it means I'm not hopping between files nearly as much. I know what's being included all the time.

我也删除了grunt,并与我自己的面料解决方案,已经在我现有的工作流程中使用。一如既往,您的里程可能会有所不同。你不是我。

I also removed grunt and went with my own fabric solution that was already used in my existing workflow. As ever, your mileage may vary. You're not me.

这篇关于为什么Bootstrap包括一个引导主题文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆