[英]Bower - How to install jquery.js only and not the whole package?
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. 使用bower install jquery
命令我在jquery
文件夹中得到的是带有jquery.js
和jquery.min.js
dist
文件夹, src
文件夹和构成jquery的整个js文件,我想, bower.json
和许可证文件。 How could I install jquery.js
or jquery.min.js
only? 我怎么能只安装jquery.js
或jquery.min.js
?
You can use bower-installer and an extra "install" section in your bower.json
file like: 您可以在bower.json
文件中使用bower-installer和额外的“install”部分,如:
{
"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”文件夹中。
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. 这将忽略下载文件时不必要的文件。
From the jQuery download page : 从jQuery下载页面 :
The jQuery Bower package contains additional files besides the default distribution. 除默认发行版之外,jQuery Bower包还包含其他文件。 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. 在大多数情况下,您可以忽略这些文件,但是如果您希望自己下载默认版本,则可以使用Bower从上述URL之一安装jQuery而不是注册包。 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 2.1.0,则可以使用以下命令安装该文件:
bower install http://code.jquery.com/jquery-2.1.0.min.js
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.