如何安装jQuery与Composer? [英] How to install jQuery with Composer?
问题描述
我已经能够安装没有composer.json文件的存储库,例如:
{
type:package,
package:{
name:yahoo / yui-compressor,
version:2.0.4 $ bdist:{
url:http://yui.zenfs.com/releases/yuicompressor/yuicompressor-2.4.7.zip,
type:zip
}
}
},
:zip部分从文档,但我找不到很多其他类型。例如,我需要安装jQuery,但我不知道在类型中放什么(js没有工作)。
{
type:package,
package:{
name:jquery / jquery,
version: 2,
dist:{
url:http://code.jquery.com/jquery-1.7.2.js,
type:js
}
}
}
p>
EDIT :我要添加完整的解决方案以帮助@CMCDragonkai:
require:{
vendorname / somefile:1.2.3,
},
repositories: [
{
type:package,
package:{
name:vendorname / somefile,
version: 1.2.3,
dist:{
url:http://example.com/somefile.txt,
type:file
}
}
}
]
这只是一个缺少的功能。应该可能有一种新的dist类型,它只是一个单一的纯文本文件,要下载并保留原样。请在github问题跟踪器上提交功能请求: https://github.com/composer/composer/issues/
编辑:
实际存在,但没有记录。
type:file
I have been able to install repositories that do not have a composer.json file like this:
{
"type": "package",
"package": {
"name": "yahoo/yui-compressor",
"version": "2.0.4",
"dist": {
"url": "http://yui.zenfs.com/releases/yuicompressor/yuicompressor-2.4.7.zip",
"type": "zip"
}
}
},
I took the "type": "zip" part from the docs, but I couldn't find many other types. For example, I need to install jQuery, but I don't know what to put in type ("js" did not work).
{
"type": "package",
"package": {
"name": "jquery/jquery",
"version": "1.7.2",
"dist": {
"url": "http://code.jquery.com/jquery-1.7.2.js",
"type": "js"
}
}
}
Any ideas?
EDIT: I'm adding the full solution to help @CMCDragonkai:
"require": {
"vendorname/somefile": "1.2.3",
},
"repositories": [
{
"type": "package",
"package": {
"name": "vendorname/somefile",
"version": "1.2.3",
"dist": {
"url": "http://example.com/somefile.txt",
"type": "file"
}
}
}
]
This is simply a missing feature. There should probably be a new type of dist which is just a single plaintext file to be downloaded and left as-is. Please file a feature request on the github issue tracker: https://github.com/composer/composer/issues/
EDIT :
The feature actually exists but wasn't documented.
"type": "file"
这篇关于如何安装jQuery与Composer?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!