“ignore” in Bower's bower.json?

只谈情不闲聊 提交于 2019-11-29 02:47:27

TL;DR:

ignore only works within the scope of packages being installed, ignoring matching patterns.


Somewhat longer answer:

Bower will ignore all files matching the patterns specified in the ignore property of bower.json in installed packages.

So, suppose if you ran bower install someBowerPackage which had following structure:

someBowerPackage
|- css/
|- js/
|- index.html
|- bower.json

with a bower.json file having:

{
  ...
  "ignore": [ "index.html" ]
}

then, index.html file of this someBowerPackage will not be installed within this package.

  • ignore is related to the files in your package
  • You can't ignore on behalf of other packages
  • Dependencies are loaded all or none

ignore values are only applied to packages fetched from a bower install endpoint by that component's bower.json file.
ignore values specified in project-root/bower.json have no effect on packages fetched as that project's components.

The bower.json Spec has been documented in its own github repo since this question was originally asked.

Ignore

Recommended
Type: Array of String

A list of files for Bower to ignore when installing your package.

Note: symbolic links will always be ignored. However bower.json will never be ignored.

The ignore rules follow the same rules specified in the gitignore pattern spec.

Files matching globs or file values in ignore will not be downloaded from an endpoint as part of the package.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!