Issue
What is the best way to install a third party library in Drupal 8 that is not on packagist?
For example I have the Color Field module, which can use the jQuery Simple Color Picker library to provide a better user experience.
The most obvious solution is to just add the library manually, but that's not really maintainable.
My second idea was to add the git repository to my composer.json, as shown below, but it doesn't work because the target repository doesn't have a composer.json file.
"repositories": [
{
"name": "jquery-simple-color",
"type": "git",
"url": "https://github.com/recurser/jquery-simple-color.git"
}
],
"require": {
"jquery-simple-color/": "1.2.1"
}
Should I just fork the git repository and add a composer.json file there?
Solution
You was on the right track, in your composer.json you can make your own "packages" for example:
"repositories": [
{
"type": "package",
"package": {
"name": "jquery/simplecolor",
"version": "1.2.1",
"dist": {
"url": "https://github.com/recurser/jquery-simple-color/archive/v1.2.1.zip",
"type": "zip"
},
"type": "drupal-library"
}
}
]
And then include it trough
"jquery/simplecolor": "1.2.1,
Answered By - melvin
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.