Bower - 如何仅安装 jquery.js 而不是整个包?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/22464049/
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
Bower - How to install jquery.js only and not the whole package?
提问by gskalinskii
Using bower install jquery
command what I get in jquery
folder are dist
folder with jquery.js
and jquery.min.js
, src
folder with the whole bunch of js files that make up jquery, I suppose, bower.json
and licence files.
How could I install jquery.js
or jquery.min.js
only?
使用bower install jquery
命令我在jquery
文件夹中得到的是dist
文件夹jquery.js
和文件夹jquery.min.js
,src
文件夹包含构成 jquery 的整个 js 文件,我想,bower.json
还有许可证文件。我如何安装jquery.js
或jquery.min.js
仅安装?
采纳答案by Yves
You can use bower-installerand an extra "install" section in your bower.json
file like:
您可以在文件中使用bower-installer和额外的“安装”部分,bower.json
例如:
{
"name": "test",
"version": "0.0.0",
"dependencies": {
"jquery": "1.11.1",
"normalize-css": "latest"
},
"install" : {
"path" : {
"js": "_js/",
"css": "_css/"
}
}
}
With that "install" section you can specify the install folder.
It than automatically creates the folders - if they're not existing - and installs just the required files like jquery.js
or normalize.css
to the specified "css" or "js" folder.
通过该“安装”部分,您可以指定安装文件夹。
然后它会自动创建文件夹 - 如果它们不存在 - 并只安装所需的文件,如jquery.js
或normalize.css
到指定的“css”或“js”文件夹。
回答by Fernando Aureliano
You can also use this parameter:
您还可以使用此参数:
"ignore": [
"source",
"spec",
".bowerrc",
".gitignore",
".jshintignore",
".jshintrc",
"bower.json",
"gruntfile.js",
"package.json",
"README.md"
],
This will ignore the unecessary files to work when you download files.
这将在您下载文件时忽略不需要的文件。
回答by Colin
From the jQuery download page:
The jQuery Bower package contains additional files besides the default distribution. In most cases you can ignore these files, however if you wish to download the default release on it's own you can use Bower to install jQuery from one of the above urls instead of the registered package. For example, if you wish to install just the compressed jQuery 2.1.0, you can install just that file with the following command:
jQuery Bower 包包含除默认分发之外的其他文件。在大多数情况下,您可以忽略这些文件,但是如果您希望自己下载默认版本,您可以使用 Bower 从上述 URL 之一而不是注册包安装 jQuery。例如,如果您只想安装压缩的 jQuery 2.1.0,您可以使用以下命令安装该文件:
bower install http://code.jquery.com/jquery-2.1.0.min.js
bower install http://code.jquery.com/jquery-2.1.0.min.js