运行bower时,属性主文件的用途是什么?我一直在寻找,许多人说,它目前没有任何目的。
这是真的吗?鲍尔的文件也解释不了这一点。
发布于 2014-01-21 18:25:37
main 推荐的类型:更好的字符串或更高级的字符串阵列 使用包所需的主要代理文件。虽然Bower不直接使用这些文件,但是列出了命令--json和bower列表--路径,这样构建工具就可以使用它们。 像CoffeeScript这样的预处理文件应该是compiled.Do (不包括小型化files.Filenames ),不应该进行版本化(Bad: package.1.1.0.js;Good: package.js)。
我认为它更适合包管理,并构建像Grunt和Brunch这样的工具。例如,Bootstrap的bower.json如下所示:
{
"name": "bootstrap",
"version": "3.0.3",
"main": [
"./dist/css/bootstrap.css",
"./dist/js/bootstrap.js",
"./dist/fonts/glyphicons-halflings-regular.eot",
"./dist/fonts/glyphicons-halflings-regular.svg",
"./dist/fonts/glyphicons-halflings-regular.ttf",
"./dist/fonts/glyphicons-halflings-regular.woff"
],
"ignore": [
"**/.*",
"_config.yml",
"CNAME",
"composer.json",
"CONTRIBUTING.md",
"docs",
"js/tests"
],
"dependencies": {
"jquery": ">= 1.9.0"
}
}当我在Brunch构建时,它会从我的bower_components文件夹中的public文件夹中提取这些文件。
发布于 2014-08-13 11:47:41
根据Bower的JSON规范(https://github.com/bower/spec/blob/master/json.md#main),“主”属性用于列出项目中主要使用的文件。列出的文件实际上并没有被Bower以任何方式使用,它们显然是为了供其他构建工具使用。
这是正式的规范:
main 推荐 类型:
String或ArrayofString使用包所需的主要代理文件。尽管Bower不直接使用这些文件,但它们是在命令bower list --json和bower list --paths中列出的,因此构建工具可以使用它们。
https://stackoverflow.com/questions/20391742
复制相似问题