如何使用 Composer 安装 jQuery? [英] How to install jQuery with Composer?

查看:34
本文介绍了如何使用 Composer 安装 jQuery?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经能够安装没有这样的 composer.json 文件的存储库:

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"
            }
        }
    },

我从文档中获取了 "type": "zip" 部分,但我找不到许多其他类型.例如,我需要安装 jQuery,但我不知道该输入什么类型(js"不起作用).

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"
            }
        }
    }

有什么想法吗?

编辑:我正在添加完整的解决方案来帮助@CMCDragonkai:

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"
                }
            }
        }
    ]

推荐答案

这只是一个缺失的功能.可能应该有一种新的 dist 类型,它只是一个要下载并保持原样的纯文本文件.请在 github 问题跟踪器上提交功能请求:https://github.com/composer/composer/issues/

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/

该功能实际存在,但没有记录.

"type": "file"

这篇关于如何使用 Composer 安装 jQuery?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆