sakhunzai
sakhunzai

Reputation: 14470

composer install jquery plugins as component using component-installer

I am trying to install a jquery plugin using component-installer , for which I have following composer.json file

{
  "config": {
    "vendor-dir": "assets/vendors",
    "component-dir": "assets/components"
  },
  "require" : {
    "robloach/component-installer": "*",
    "components/jquery": "2.*",
    "components/jqueryui": "1.11.*",
    "Krinkle/jquery-json": "dev-master"
  },
  "repositories": {
    "jquery-json" : {
      "type": "package",
      "package": {
        "require": {
          "robloach/component-installer": "*"
        },
        "name": "Krinkle/jquery-json",
        "type": "component",
        "version": "master",
        "source": {
          "url": "git://github.com/Krinkle/jquery-json.git",
          "type": "git",
          "reference": "master"
        },
        "extra": {
          "component": {
            "scripts": [
              "dist/jquery-json.min.js"
            ]

          }
        }
      }
    }
  }
}

This works fine but Krinkle/jquery-json is downloaded to assets/vendors directory instead of asserts/components. I have lots of plugins to setup this way if this experiment works, and defining all the plugins will increase the size of composer.json files . Is there a way to keep keep package files on external json file e.g jquery-json.json and include it in main composer.json file ?

Any other suggestion to manage assets/js components using composer will be much appropriated.

Upvotes: 2

Views: 2300

Answers (1)

Tomas Votruba
Tomas Votruba

Reputation: 24280

Your setup looks quite complicated. I'd recommend you checking composer-asset-plugin package, that allows pretty much the same. Just in more simple and fancy way.

Upvotes: 1

Related Questions