twitter-bootstrap Twitter Bootstraps config.json - 它有什么作用?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21433655/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 19:52:50  来源:igfitidea点击:

Twitter Bootstraps config.json - what does it do?

twitter-bootstraptwitter-bootstrap-3

提问by David

I'm trying to find a way to only include specific bootstrap sections (css or js) but so far I just write a list down of what I am using, then tick those boxes on their customiser page.

我试图找到一种方法只包含特定的引导程序部分(css 或 js),但到目前为止我只是写下我正在使用的列表,然后在他们的定制器页面上勾选这些框。

However I noticed a config.jsonfile that gets downloaded in the zip file, what does it do? I currently use boweras my asset package manager and gulpas my asset pipeline. But I don't think a config.jsonis relevant to them?

但是我注意到config.json在 zip 文件中下载了一个文件,它有什么作用?我目前bower用作我的资产包管理器和gulp我的资产管道。但我不认为 aconfig.json与他们有关?

Thank you.

谢谢你。

采纳答案by strings28

The config.json file can be used with the full master download from github to config your build with grunt.

config.json 文件可与从 github 下载的完整主文件一起使用,以使用 grunt 配置您的构建。

[edit] Folks asked for more details: Bootstrap uses grunt, a JavaScript focused build utility similar to Java's Ant, that can build projects and executed automated tasks. The grunt build could theoretically read the config.json file and modify its build to meet some specific tasks you need through changing the default config.json file and adding to, or subtracting from, the specific settings it contains.

[编辑] 人们询问更多详细信息:Bootstrap 使用 grunt,这是一种类似于 Java 的 Ant 的专注于 JavaScript 的构建实用程序,可以构建项目并执行自动化任务。grunt 构建理论上可以读取 config.json 文件并修改其构建以满足您需要通过更改默认 config.json 文件并添加或减去其中包含的特定设置的某些特定任务。

Disclosure: I don't personally use grunt.js, but I have much respect for its creator, Ben. I should probably learn how to use this tool.

披露:我个人不使用 grunt.js,但我非常尊重它的创建者 Ben。我可能应该学习如何使用这个工具。

回答by Sean Ryan

The config.jsonfile that is downloaded is nothing but a reminder of what your settings were when you downloaded. I would assume there will be some future functionality that would allow you to upload that file in to the website and reproduce the customized settings, but that feature doesn't currently exist, as far as I can tell.

config.json下载的文件只是提醒您下载时的设置。我假设将来会有一些功能允许您将该文件上传到网站并重现自定义设置,但据我所知,该功能目前不存在。

If you are using bower, I would suggest using it to download Bootstrap for you. You can then use a LESS file to pull in the CSS features you want, and compile it using gulp/grunt in to your public asset directory. You can also use gulp/grunt to copy over the individual JS files you want in to a single file in that same asset directory.

如果您使用的是 bower,我建议您使用它为您下载 Bootstrap。然后,您可以使用 LESS 文件拉入您想要的 CSS 功能,并使用 gulp/grunt 将其编译到您的公共资产目录中。您还可以使用 gulp/grunt 将您想要的各个 JS 文件复制到同一资产目录中的单个文件中。

回答by cvrebert

config.json stores the Customizersettings you used for your custom Bootstrap build.

config.json 存储您用于自定义 Bootstrap 构建的定制器设置。

You can reload those settings into the Customizerusing the file upload at the top of the page, as of Bootstrap v3.3.0.

从 Bootstrap v3.3.0 开始,您可以使用页面顶部的文件上传将这些设置重新加载到定制器中。

You can also alternatively extract the LESS variable values from the JSON and compile Bootstrap manually using those values, if you have a LESS compiler installed locally.

如果您在本地安装了 LESS 编译器,您也可以从 JSON 中提取 LESS 变量值并使用这些值手动编译 Bootstrap。

回答by tomalex

This post might be old, but thought to update with what i have done.

这篇文章可能很旧,但我想更新我所做的。

Issue

问题

I have done some customization from http://getbootstrap.com/customize/which inturn provided config.jsonfile. It would have been handy if variables.lessfiles was also generated.

我已经做了一些定制,从中http://getbootstrap.com/customize/又提供了config.json文件。如果variables.less还生成了文件,那会很方便。

Solution

解决方案

For this reason i quickly setup a nodejs program to generate variables.lessfrom config.jsonhttps://github.com/tomalex0/bootstrap-config-to-variable

出于这个原因,我快速设置了一个 nodejs 程序以variables.lesshttps://github.com/tomalex0/bootstrap-config-to-variable生成config.json

回答by MisterZimbu

At the very bottom of the .json file, there's a link that will reload your settings in getbootstrap.com:

在 .json 文件的最底部,有一个链接可以在 getbootstrap.com 中重新加载您的设置:

"customizerUrl": "http://getbootstrap.com/customize/?id={random_id}"

Not sure how long the URL will be valid for, though.

不过,不确定 URL 的有效期有多长。